Fonceur Posted December 13, 2004 Posted December 13, 2004 I am trying to make my Windows 98 unattended CD as generic as possible, so I was wondering if there is any way to use some variables in a .reg file... Basically, I would like to replace:REGEDIT4[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\zz100]"1"="C:\\windows\\Install\\netfx.msi /QB"@="Dot NET Framework v1.1"with something using a variable like %windir%:REGEDIT4[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\zz130]"1"="%windir%\Install\\netfx.msi /QB"@="Dot NET Framework v1.1"
kukris Posted December 14, 2004 Posted December 14, 2004 As far as I know %windir% is the only variable that can be used, though I don't know if that works in reg files, but it works in batch files.An other method is to use inf-files. They have code numbers for various Windows folders, like 10 for the Windows folder. I use this to copy files to Windows folders via msbatch.inf like:[Install]CopyFiles=winfile.copy, winsysfile.copy, inffile.copy, IOSubSysfile.copy, vmm32file.copy, rootfile.copy[winfile.copy]Editor2.exe[vmm32file.copy]Ios.vxd[DestinationDirs]winfile.copy=10winsysfile.copy=11inffile.copy=17IOSubSysfile.copy=12vmm32file.copy=22rootfile.copy=30
nil Posted December 14, 2004 Posted December 14, 2004 I tested the following[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Fault]"LogFile"="%windir%\\temp\\FAULTLOG.TXT"and the resulting string was "%windir%\temp\FAULTLOG.TXT". The system seemed to treat %windir% as a literal directory name instead of expanding the variable when it was needed in this case (I forced a fault and it wasn't recorded) though other programs may treat it differently when it's called (I didn't test msi).The hassle with trying to build and run a reg file using %windir% within a batch file, e.g. >tmp.reg echo REGEDIT4>>tmp.reg echo.>>tmp.reg echo [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Fault]>>tmp.reg echo "LogFile"="%windir%\\FAULTLOG.TXT">>tmp.reg echo.regedit /s tmp.regdel tmp.regis the difficulty in adding an extra \ to the %windir% path (e.g., c:\\Windows), which regedit seems to want (when I tried the above the previous registry entry was not modified, nor was it recreated after deleting the entry). I've got no idea how you'd go about adding the extra seperator. (You could use a third-party search/replace command but then you may as well just edit the original reg file directly.)
Yzöwl Posted December 14, 2004 Posted December 14, 2004 What about just adding two lines like this to your batch file:reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\zz100 /v 1 /d "%windir%\Install\netfx.msi /QB" /freg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\zz100 /v "" /d "Dot NET Framework v1.1" /f
nil Posted December 14, 2004 Posted December 14, 2004 Is 'reg' an ME command Yzöwl, can't seem to find it on Win98SE.
Yzöwl Posted December 14, 2004 Posted December 14, 2004 My mistake, it may be in the Windows 98 Resource Kit[EDIT]Why not try an inf instead:[Version]Signature=$CHICAGO$[DefaultInstall]AddReg = Reg.Settings[Reg.Settings]HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\zz100",,0,"Dot NET Framework v1.1"HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\zz100","1",0,"%10%\Install\netfx.msi /QB"[/EDIT]Also are you sure that the install directory is in C:\Windows and not just C:, for C: you would use %11% instead of %10%
Fonceur Posted December 14, 2004 Author Posted December 14, 2004 Thanks for the various suggestions.Too bad that the REG /ADD function is not defined in Win98, I use it in Win XP and it makes all those things much easier.I did consider using the ECHO >> trick, but that seems a bit messy if I want to add alot of entries that way.So it looks as if using some .inf files will be the easiest way to do what I want. Is there a complete list of the LDID (%10% and such) somewhere? There is a partial list at the online Microsoft Windows 98 Resource Kit (appendix C), but for example there is no mention of the startup folder...And yes I do put my install folder inside %windir%, makes it easier in batch file since I don't have to use tricks to determine the partition of that folder...
nil Posted December 15, 2004 Posted December 15, 2004 Too true Fonceur. In theory you can add an extra seperator using plain DOS but it takes the batch file from messy to ridiculous.Here's a partial list of inf "dirid" values I've just build up after reading "Creating shortcuts using INF files" by Daniel U. Thibault (http://www.robvanderwoude.com/shortcutinf.html). I presume they are constant values. I couldn't be bother testing beyond 100... let me know if you find anything new, or a link to a more complete list.[edited 16 Jan 05]; 1=SourceDrive:\pathname of the directory from which the INF file was installed; 2=c:\WININST0.400; 3=c:\UNINSTAL.000; 4=c:\UNINSTAL.000; 5=inf; 10=windows; 11=system (or system32 on Windows NT); 12=system\iosubsystem; 13=command; 17=inf; 18=help; 19=windows; 20=fonts; 21=system\viewers; 22=VMM32; 23=color; 24=c: (the Applications folder [ie. Program Files] root); 25=windows (MS doc refers to this as the "Shared directory". ?); 27=c:; 28=windows; 30=c: Root directory of the boot disk (might not be the same directory as dirid24); 31=c: (as above?); 32=c:\Winboot; 33=start menu\programs; 50 System directory (%windir%\system) on NT-based OS (only); 51 Spool directory (not used for installing printer drivers); 52 Spool drivers directory (not used for installing printer drivers) ; 53 User profile directory ; 54 Directory where ntldr.exe and osloader.exe are located (NT-based systems only) ; 55 Print processors directory (not used for installing printer drivers) ; Value Shell Special Folder ;; 16406 All Users\Start Menu ; 16407 All Users\Start Menu\Programs ; 16408 All Users\Start Menu\Programs\Startup ; 16409 All Users\Desktop ; 16415 All Users\Favorites ; 16419 All Users\Application Data ; 16422 Program Files ; 16427 Program Files\Common ; 16429 All Users\Templates ; 16430 All Users\Documents The author of the doc above adds this - "%24% is the Applications (Program Files) directory root (typically C:\).The entire %24%\Progra~1\Access~1\ path can be retrieved as %28710% under Win 98 and later."Thanks Yzöwl, just downloaded reg.exe from the Resource Kit. (Dialup, only 100 odd hours to go...) Looks neat.
jelev Posted December 15, 2004 Posted December 15, 2004 REGEDIT4[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\zz130]"1"="%windir% \ Install\\netfx.msi /QB"@="Dot NET Framework v1.1"hmm
nil Posted December 15, 2004 Posted December 15, 2004 Well spotted jelev but I'm not sure that's the problem, eg[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Runonce]@="c:\\Windows\\desktop\\tst.bat"works fine (Win 98SE) but not:[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Runonce]@="%windir%\\desktop\\tst.bat"%windir% doesn't seem to get expanded either by regedit or the OS when it reads it.[Edit]A sidenote some might find interesting - "%windir%" appears to be a valid directory name so the above would run "c:\%windir%\desktop\tst.bat" if it existed... Useless but true.
Fonceur Posted December 16, 2004 Author Posted December 16, 2004 I decided to try again the REG ADD route, so I got the REG.EXE file from the Win98 Resource kit. It does not quite have the same functionality as the Win XP version, but it is close enough.I can't seem to modify the (Default) value with REG ADD, which should be something like @... So I guess I will need to also load a normal registry file with all the name of the programs/patches I want to install. At least the REG ADD takes care of the %windir% variable, so that's the important part.REGEDIT4[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\zz100]@="Dot NET Framework v1.1"[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\zz110]@="directX 9c"...
Yzöwl Posted December 16, 2004 Posted December 16, 2004 Just use the line I gave earlieri.e. replace @ with ""
Fonceur Posted December 16, 2004 Author Posted December 16, 2004 Just use the line I gave earlieri.e. replace @ with ""Except that /v, /d and /f are not valid options with the REG ADD from the Win98 resource kit and result in a too many command-line parameters error...
chon_ Posted January 7, 2005 Posted January 7, 2005 Did you manage to change the @= key with REG.EXE? I can't find how to do it in w2k & xp you can do it with the /V /VE switches, but I don't know how to do it in win98. Anyone?
jaclaz Posted January 7, 2005 Posted January 7, 2005 Already posted a few times, but won't this do?Nirsofthttp://www.nirsoft.net/utils/nircmd2.htmljaclaz
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now