Re: Remove Carriage return in BATCH file



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


.



Relevant Pages

  • Re: Remove Carriage return in BATCH file
    ... call:getSource "%key%\%%A")) ... 'reg.exe query "%~1\SourceList" /V LastUsedSource' ... GOTO:EOF ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: Remove Carriage return in BATCH file
    ... The NEW reg is 5.1.2600.2180 ... call:getSource "%key%\%%A")) ... GOTO:EOF ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: Obtaining Last Logon Time for Domain User
    ... Subject: Re: Last time each NT account was accessed ... > framework 1.1 to run this tool (you can get it from Windows Update). ... >> goto:EOF ...
    (microsoft.public.windows.server.active_directory)
  • Re: recognize EOF condition when using GoToRecord Action
    ... VB experts have specifically recommended that GoTo ... I would recommend putting your code lines in ... learning what error number arises on an EOF ... And we have recordsets when we need to be slow, ...
    (comp.databases.ms-access)
  • Re: Which query is running
    ... GetAddress is the name of a function which combines and formats the address ... Each query could contain more than 1 output field that need parameters to be ... This is part of a Club database. ... On Error GoTo GetParameters_Err ...
    (comp.databases.ms-access)

Loading