Guest Posted May 10, 2011 Posted May 10, 2011 (edited) echo HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\KB975254,"Installed",0x10001,1 >>entries_KB975254.iniecho HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\KB975254,"Comments",0,"Security Update for Windows XP (KB975254)">>entries_KB975254.iniOn the first line I have to add a space between 1 >> or it will drop the 1.Anyone know why this is and if there is a way to do it without adding a space?Thanks!EDIT: It also chokes on % characters.For example...echo Base.AppDir.Mui.CopyFile= 16422,%MSIE4%\%MuiCultureDirectory%>file.txtcomes out like this...Base.AppDir.Mui.CopyFile= 16422,\ Edited May 10, 2011 by -X-
allen2 Posted May 11, 2011 Posted May 11, 2011 (echo HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\KB975254,"Installed",0x10001,1)>>entries_KB975254.ini(echo Base.AppDir.Mui.CopyFile= 16422,%%MSIE4%%\%%MuiCultureDirectory%%)>>entries_KB975254.iniThis code should work. The usual dos escape character (^) didn't work with the "%" and in these cases, doubling the character works.
Yzöwl Posted May 11, 2011 Posted May 11, 2011 When you redirect output, you can chose to redirect STDERR and/or STDOUT.STDERR is redirected thus 2>erroutput.log STDOUT is redirected 1>output.log, the 1 is assumed as default.The problem is that it appears to the command parser as if you've included the 1; and because it was assumed it was therefore dropped, (removed).It would be good practice to always include it and/or always include the space.ECHO=HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\KB975254","Installed",0x10001,1 1>>entries_KB975254.iniECHO=HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\KB975254","Comments",,"Security Update for Windows XP (KB975254)" 1>>entries_KB975254.iniMy preference is to move the redirection to the other end of the command line@ECHO OFFSETLOCALSET "HFKEY=SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix">entries_KB975254.ini ( ECHO=HKLM, "%HFKEY%\KB975254", "Installed", 0x10001, 1 ECHO=HKLM, "%HFKEY%\KB975254", "Comments", ,^ "Security Update for Windows XP (KB975254)")
Guest Posted May 11, 2011 Posted May 11, 2011 Another way to add the redirect is to place it just after ECHO.echo>>entries_KB975254.ini HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\KB975254,"Installed",0x10001,1echo>>entries_KB975254.ini HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\KB975254,"Comments",0,"Security Update for Windows XP (KB975254)"echo>file.txt Base.AppDir.Mui.CopyFile= 16422,%%MSIE4%%\%%MuiCultureDirectory%%
Yzöwl Posted May 11, 2011 Posted May 11, 2011 Note that in my examples I added double-quotes to the registry key due to the space in its path.
Guest Posted May 11, 2011 Posted May 11, 2011 (edited) Using double quotes is good general practice, but is not strictly necessary unless dealing directly with registry hive files. In that case, datatypes should not be omitted or abbreviated: 0 should be 0x00000000 and 0x10001 should be 0x00010001. [strings] sections should also be avoided in hive files. Extra spaces around comma delimiters may also be problematic. Edited May 11, 2011 by 5eraph
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