melnib00ne Posted July 8, 2005 Share Posted July 8, 2005 Hello,i have an problem by an variable.thats the code:for /f "tokens=*" %%g in ('dir/b ^"%cddrive%\hotfixes\%osv%\%lang%\^"') do reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\%%g" /v Installed | find "0x1" > nulif errorlevel 1 start /wait .....the batch looking the files on my share, then he looks for the installed hotfixes and when an hotfix was not installed, but in the directory exist the script goes to install... thats the idea.,the problem is the %%g variable, if i run before reg query the echo command, the script told me all hotfixes in the directory, but not in the reg query command.any solutions, ideas ? Link to comment Share on other sites More sharing options...
Martin Zugec Posted July 8, 2005 Share Posted July 8, 2005 Why not using WSUS for this purposes (I suppose it is for LAN, right?)... But for your problem, I am sorry I didnt understand - what echo command??? Easier error-prone way would be to redirect registry to file and then make file content/FS compare... Link to comment Share on other sites More sharing options...
melnib00ne Posted July 8, 2005 Author Share Posted July 8, 2005 (edited) wus is very nice, but i would save the hotfixes on my share, folders or cd and the batch is cleaner, no server, no connection need, etc./BR Edited July 8, 2005 by melnib00ne Link to comment Share on other sites More sharing options...
Yzöwl Posted July 8, 2005 Share Posted July 8, 2005 I think you main problem is that the variable %g is returning a filename with path and extension, whereas the queried subkey has no extension will be the filename only.You would therefore need to use %%~ng in your reg query command.Here is a modified version of what you gave usfor /f "delims=" %%g in ('dir /b/a-d "%cddrive%\hotfixes\%osv%\%lang%\*.exe"') do ( reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\%%~ng" /v Installed|find "0x1">nul||start "" /wait .....) Link to comment Share on other sites More sharing options...
melnib00ne Posted July 9, 2005 Author Share Posted July 9, 2005 (edited) @Yzöwlthanks, thats what i need... some modifications and it works....but i forgot to build an loop, now i must run the batch xx of hotfixes are in the folder.any solutions again ?heres my working code:if exist "c:\programme\" set lang=DEUif exist "c:\program files\" set lang=ENUver | find /i "3790" > nulif not errorlevel 1 set osv=ws2k3ver | find /i "2600" > nulif not errorlevel 1 set osv=WindowsXPfor /f "delims=" %%g in ('dir /b ^"%cddrive%\hotfixes\%osv%\%lang%\^"') do (reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\%%~g" /v Installed | find "0x1" > nul||start /wait %cddrive%\hotfixes\%osv%\%lang%\%%g\%osv%-%%~g-x86-%lang%.exe /quiet /norestart)/BR Edited July 9, 2005 by melnib00ne Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now