Re: Remove Carriage return in BATCH file
- From: "wayne" <warant@xxxxxxxxxxx>
- Date: Mon, 13 Feb 2006 11:50:56 -0500
I see what you mean about the /v with the nested for, however I don't
understand the line
if "!my_ProductName!" NEQ "!my_ProductName:%prodN%=!"
Specifically I don't know what the ! is doing.
If you have a minute could you shed some light on that?
Thanks.
Wayne
"Matthias Tacke" <Matthias@xxxxxxxx> wrote in message
news:dsj0m9.3c8.1@xxxxxxxxxxxxxxxx
wayne schrieb:
Windows ver is 2000 and up (seems to be when they changed the behavior)
My OLD reg version is 5.0.2
The NEW reg is 5.1.2600.2180
It's with a /list. /s is new, but they do almost the same thing.
/v doesn't help because I don't know the full path I need, I'm looking
for it.
You may use the xp version of reg.exe also in w2k to ease handling with
the newer unique syntax. The is also a more recent version for w2k hidden
somewhere in the ms site.
When using two nested for loops you _can_ use /v because the actual key
used is still present in the var %%A in my example.
You will have to check the contents of ProductName for every single entry.
My example stores all values in environment variables. You only need to
replace the "set my_" statement with your check commands.
Try this one with REG.exe v 3.0
::OfficeCheck.cmd::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
setlocal EnableExtensions EnableDelayedExpansion
set key=hkcr\installer\products
set prodN=Microsoft Office
for /f "tokens=4 delims=\" %%A in (
'reg.exe query "%key%" ^|findstr "products."'
) do (
setlocal
set my_=%%A
for /f "skip=4 tokens=1-2,*" %%B in (
'reg.exe query "%key%\%%A"'
) do set my_%%B=%%D
if defined my_ProductName (
if "!my_ProductName!" NEQ "!my_ProductName:%prodN%=!" (
call :getSource "%key%\%%A"))
endlocal
)
goto :eof
:getSource
for /f "tokens=3 delims=;" %%E in (
'reg.exe query "%~1\SourceList" /V LastUsedSource'
) do echo %1,"%my_ProductName%","%%E" >> InstalledOffice.csv
GOTO :EOF
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
HTH
Matthias
.
- Follow-Ups:
- Re: Remove Carriage return in BATCH file
- From: foxidrive
- Re: Remove Carriage return in BATCH file
- References:
- Remove Carriage return in BATCH file
- From: wayne
- Re: Remove Carriage return in BATCH file
- From: Matthias Tacke
- Re: Remove Carriage return in BATCH file
- From: wayne
- Re: Remove Carriage return in BATCH file
- From: Matthias Tacke
- Remove Carriage return in BATCH file
- Prev by Date: Re: Getting Display Name in Logon Script
- Next by Date: Re: Remove Carriage return in BATCH file
- Previous by thread: Re: Remove Carriage return in BATCH file
- Next by thread: Re: Remove Carriage return in BATCH file
- Index(es):
Relevant Pages
|
Loading