Jump to content

[HELP] RunOnceEx from CD


Recommended Posts

I just finished reading the "RunOnceEX from CD" and there is something not so clear that I didn't get.

**********************************

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.

**********************************

Where do I put the SetLocal enableextensions? Is this the correct way?

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:

SetLocal enableextensions
SET CDROM=%~d0

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

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

REG ADD %KEY%\005 /VE /D "Adobe Acrobat 7.0.5" /f
REG ADD %KEY%\005 /V 1 /D "%CDROM%\switchless\reader705.exe" /f

REG ADD %KEY%\010 /VE /D "Microsoft .NET Framework 2.0" /f
REG ADD %KEY%\010 /V 1 /D "%CDROM%\switchless\dotnet2.exe" /f

EndLocal
EXIT

Is this correct? Thanks in advance for any help. :)

Edited by LazyBoy
Link to comment
Share on other sites


It says alternatively, therefore either

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:

or

SetLocal enableextensions
SET CDROM=%~d0

However, the first example is still badly advised, but that is a matter for the unattended guide and not really of concern to yourself.

Link to comment
Share on other sites

Can I use cmdow @ /HID with the alternate method? Like

cmdow @ /HID
SetLocal enableextensions
SET CDROM=%~d0

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

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

REG ADD %KEY%\005 /VE /D "Adobe Acrobat 7.0.5" /f
REG ADD %KEY%\005 /V 1 /D "%CDROM%\switchless\reader705.exe" /f

REG ADD %KEY%\010 /VE /D "Microsoft .NET Framework 2.0" /f
REG ADD %KEY%\010 /V 1 /D "%CDROM%\switchless\dotnet2.exe" /f

EndLocal
EXIT

I haven't seen how RunOnceEx from CD works out but is cmdow needed?

Link to comment
Share on other sites

Can I use cmdow @ /HID with the alternate method? Like

cmdow @ /HID
SetLocal enableextensions
SET CDROM=%~d0
<snip>

Yes, all CMDOW is doing in this case is hiding the cmd window. Since there is no need to turn echoing off, the only thing required in your example is to alter the first line to prevent that being echoed too
@cmdow @ /hid

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...