Jump to content

RunOnceEx from CD.


Recommended Posts

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 mind

The %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! :thumbup

Edited by Raoul90
Link to comment
Share on other sites


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 EnableExtensions
SET CDROM=%~d0

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY% /V TITLE /D "Installing Applications" /f

REG ADD %KEY%\005 /VE /D "My Application" /f
REG ADD %KEY%\005 /V 1 /D "%~d0\install\myapp.exe" /f
...
...
EndLocal

Exit

Obviously you would replace the folder name "install" with whatever you are using for your apps.

Edited by krose
Link to comment
Share on other sites

SetLocal EnableExtensions

SET CDROM=%~d0

What 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 off

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:

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY% /V TITLE /D "Installatie/registratie van enkele applicaties" /f

REG ADD %KEY%\001 /VE /D "Registratie van: PowerISO 4.4" /f

REG ADD %KEY%\001 /V 1 /D "REGEDIT /S %CDROM%\SOFTWARE\poweriso.reg" /f

REG ADD %KEY%\002 /VE /D "Registratie van: Malwarebytes Anti Malware" /f

REG ADD %KEY%\002 /V 1 /D "REGEDIT /S %CDROM%\SOFTWARE\regmbam.reg" /f

REG ADD %KEY%\003 /VE /D "Installatie van: Skype 4.0 Lite" /f

REG ADD %KEY%\003 /V 1 /D "%CDROM%\SOFTWARE\SkypeSTD_400226.exe" /f

REG ADD %KEY%\004 /VE /D "Installatie van: DirectX 9.0c Runtimes Maart" /f

REG ADD %KEY%\004 /V 1 /D "%CDROM%\SOFTWARE\RedDXRuntimes_0.7.0_32bit.exe" /f

REG ADD %KEY%\005 /VE /D "Installatie van: DirectX 9.0c Managed Code Maart" /f

REG ADD %KEY%\005 /V 1 /D "%CDROM%\SOFTWARE\RedDXManaged_1.1.0.exe" /f

REG ADD %KEY%\006 /VE /D "Installatie van: Paint.NET V3.36" /f

REG ADD %KEY%\006 /V 1 /D "%CDROM%\SOFTWARE\PaintNET-V3.36.msi" /f

..

..

..

EXIT

And I should make it like this?

cmdow @ /HID

@echo off

SetLocal EnableExtensions

SET CDROM=%~d0

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY% /V TITLE /D "Installatie/registratie van enkele applicaties" /f

REG ADD %KEY%\001 /VE /D "Registratie van: PowerISO 4.4" /f

REG ADD %KEY%\001 /V 1 /D "REGEDIT /S %~d0\SOFTWARE\poweriso.reg" /f

REG ADD %KEY%\002 /VE /D "Registratie van: Malwarebytes Anti Malware" /f

REG ADD %KEY%\002 /V 1 /D "REGEDIT /S %~d0\SOFTWARE\regmbam.reg" /f

REG ADD %KEY%\003 /VE /D "Installatie van: Skype 4.0 Lite" /f

REG ADD %KEY%\003 /V 1 /D "%~d0\SOFTWARE\SkypeSTD_400226.exe" /f

REG ADD %KEY%\004 /VE /D "Installatie van: DirectX 9.0c Runtimes Maart" /f

REG ADD %KEY%\004 /V 1 /D "%~d0\SOFTWARE\RedDXRuntimes_0.7.0_32bit.exe" /f

REG ADD %KEY%\005 /VE /D "Installatie van: DirectX 9.0c Managed Code Maart" /f

REG ADD %KEY%\005 /V 1 /D "%~d0\SOFTWARE\RedDXManaged_1.1.0.exe" /f

REG ADD %KEY%\006 /VE /D "Installatie van: Paint.NET V3.36" /f

REG ADD %KEY%\006 /V 1 /D "%~d0\SOFTWARE\PaintNET-V3.36.msi" /f

..

..

..

EndLocal

EXIT

Link to comment
Share on other sites

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 enableextensions
SET CDROM=%~d0

It 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 include

EndLocal

before 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 by krose
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...