Raoul90 Posted May 28, 2009 Share Posted May 28, 2009 (edited) Hey,Im using RunOnceEx from CD for some applications.I have a CD.txt in the root of the XP-image.FOR %%i IN (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%i:\CD.txt SET CDROM=%%i:Is in the RunOnceEx.cmd.In VMWare it works all fine.But when I do a live install I get an error @ RunOnceEx.RunOnceEx can't find "%CDROM%\SOFTWARE\SkypeSTD_400226.exe" and all the other programs.Basicly it cant find the ""%CDROM%".And I think that this is because of the CD.txt.Other things to keep in mindThe %CDROM% environment variable isn't permanent, and only lasts during the session of when the cmd file is ran. Since we have the FOR statement and the REG ADD entries in one single cmd file, there is nothing else to worry about. However, if you run another different cmd file that accesses a file on the CD, you should include the FOR statement in that cmd file as well.Should you need a permanent environment variable, consider using an utility such as DetectCD.exe or setenv.exe.CD.txt isnt permanent, and I think that is the problem.But I tried DetectCD.exe, but it cant be found anymore.And setenv.exe is a bit complicated? Someone could explain it a bit?Or does anyone knows an other permanent CD-detecter?Thanks in advance! Edited May 28, 2009 by Raoul90 Link to comment Share on other sites More sharing options...
krose Posted May 28, 2009 Share Posted May 28, 2009 (edited) I would try using one of the WinXP identifier files in the root of your CD as the filename in your RunOnceEx instead of CD.txt. I was using the win51ip.sp3 file before I found another way that is much simpler.SetLocal EnableExtensionsSET CDROM=%~d0SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceExREG ADD %KEY% /V TITLE /D "Installing Applications" /fREG ADD %KEY%\005 /VE /D "My Application" /fREG ADD %KEY%\005 /V 1 /D "%~d0\install\myapp.exe" /f......EndLocalExitObviously you would replace the folder name "install" with whatever you are using for your apps. Edited May 28, 2009 by krose Link to comment Share on other sites More sharing options...
Raoul90 Posted May 28, 2009 Author Share Posted May 28, 2009 SetLocal EnableExtensionsSET CDROM=%~d0What exactly does the SetLocal? Google isnt telling me that.And when I use this, it finds the CDROM?This is how my RunOnceEx is now:cmdow @ /HID@echo offFOR %%i IN (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%i:\CD.txt SET CDROM=%%i:SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceExREG ADD %KEY% /V TITLE /D "Installatie/registratie van enkele applicaties" /fREG ADD %KEY%\001 /VE /D "Registratie van: PowerISO 4.4" /fREG ADD %KEY%\001 /V 1 /D "REGEDIT /S %CDROM%\SOFTWARE\poweriso.reg" /fREG ADD %KEY%\002 /VE /D "Registratie van: Malwarebytes Anti Malware" /fREG ADD %KEY%\002 /V 1 /D "REGEDIT /S %CDROM%\SOFTWARE\regmbam.reg" /fREG ADD %KEY%\003 /VE /D "Installatie van: Skype 4.0 Lite" /fREG ADD %KEY%\003 /V 1 /D "%CDROM%\SOFTWARE\SkypeSTD_400226.exe" /fREG ADD %KEY%\004 /VE /D "Installatie van: DirectX 9.0c Runtimes Maart" /fREG ADD %KEY%\004 /V 1 /D "%CDROM%\SOFTWARE\RedDXRuntimes_0.7.0_32bit.exe" /fREG ADD %KEY%\005 /VE /D "Installatie van: DirectX 9.0c Managed Code Maart" /fREG ADD %KEY%\005 /V 1 /D "%CDROM%\SOFTWARE\RedDXManaged_1.1.0.exe" /fREG ADD %KEY%\006 /VE /D "Installatie van: Paint.NET V3.36" /fREG ADD %KEY%\006 /V 1 /D "%CDROM%\SOFTWARE\PaintNET-V3.36.msi" /f......EXITAnd I should make it like this?cmdow @ /HID@echo offSetLocal EnableExtensionsSET CDROM=%~d0SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceExREG ADD %KEY% /V TITLE /D "Installatie/registratie van enkele applicaties" /fREG ADD %KEY%\001 /VE /D "Registratie van: PowerISO 4.4" /fREG ADD %KEY%\001 /V 1 /D "REGEDIT /S %~d0\SOFTWARE\poweriso.reg" /fREG ADD %KEY%\002 /VE /D "Registratie van: Malwarebytes Anti Malware" /fREG ADD %KEY%\002 /V 1 /D "REGEDIT /S %~d0\SOFTWARE\regmbam.reg" /fREG ADD %KEY%\003 /VE /D "Installatie van: Skype 4.0 Lite" /fREG ADD %KEY%\003 /V 1 /D "%~d0\SOFTWARE\SkypeSTD_400226.exe" /fREG ADD %KEY%\004 /VE /D "Installatie van: DirectX 9.0c Runtimes Maart" /fREG ADD %KEY%\004 /V 1 /D "%~d0\SOFTWARE\RedDXRuntimes_0.7.0_32bit.exe" /fREG ADD %KEY%\005 /VE /D "Installatie van: DirectX 9.0c Managed Code Maart" /fREG ADD %KEY%\005 /V 1 /D "%~d0\SOFTWARE\RedDXManaged_1.1.0.exe" /fREG ADD %KEY%\006 /VE /D "Installatie van: Paint.NET V3.36" /fREG ADD %KEY%\006 /V 1 /D "%~d0\SOFTWARE\PaintNET-V3.36.msi" /f......EndLocalEXIT Link to comment Share on other sites More sharing options...
krose Posted May 28, 2009 Share Posted May 28, 2009 (edited) Open a command window and at the command prompt type "setlocal /?" (without the quotes) to get the usage. The method is covered in the unattended guide here. Alternatively, you can use the following code to set the %CDROM% variable if you wish to not be bothered by the CD.txt file requirements, or the inefficiency of checking every drive for a specific file, used of the previous method.SetLocal enableextensionsSET CDROM=%~d0It works by setting the %CDROM% variable to the same drive on which the script resides. In this case, the script being the actual RunOnceEx.cmd file. Just make sure you also includeEndLocalbefore the EXIT line, to close the extension. Keep in mind, when the extension is closed, the %CDROM% variable will be reset. For consistency, this guide will use the first method, but both are working solutions.What you posted last is correct and should work. But I still can't figure out why your cd.txt method did not work. Your RunOnceEx looked OK to me. And why it worked in VMWare and not live? Who knows. At any rate, good luck. Edited May 28, 2009 by krose Link to comment Share on other sites More sharing options...
Raoul90 Posted May 29, 2009 Author Share Posted May 29, 2009 Ah I missed that part in this guide. Gonna try it like this. Thanks for the explanation. 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