Jump to content

runonceex.cmd no working on CD (on cd multi-drive)


Recommended Posts

as stated in this article,

- adding a cd.txt file to the cd being burned;

- adding these lines to the runconceex.cmd and modifying the path where files are to be installed from:

IF EXIST D:\CD.txt set CDROM=D:IF EXIST E:\CD.txt set CDROM=E:IF EXIST F:\CD.txt set CDROM=F:IF EXIST G:\CD.txt set CDROM=G:IF EXIST H:\CD.txt set CDROM=H:IF EXIST I:\CD.txt set CDROM=I:IF EXIST J:\CD.txt set CDROM=J:

can give me the possibility to install apps from cd during an unattended install.

this approached worked for me at a degree, that is if i have no other removable or optical drives present on my pc. otherwise, once it searches the drive letter of the removable drive - zip100 (drive F) prior to the drive letter where the xpcd is (drive G), a popup window with an error appears.

cmd.exe - No Disk

There is no disk in the drive. Please insert a disk into drive \Device\Harddisk1\DR1

Cancel Try Again Continue

with this, i had to quickly press continue for the batch file (runonceex.cmd) to continue running. otherwise, it would halt the execution of my batch file w/c would ruin the unattended'ness of the cd. this also happens when i try installing from the next optical drive (drive H) on the same pc.

so, hoping to ease my frustration, i tried other options as mentioned on the same article, by using the tools called detectcd2.exe and setenv.exe, i could be able to minimize which drives to check for the file on the cd (cd.txt) when using the IF EXIST statement.

its been days and i really can't figure out how these two programs work under an IF EXIST statement.

anyhow, these is an excerpt of my runconceex.cmd

cmdow @ /HID
DetectCD2
IF EXIST %CDROM1%\cd.txt setenv /m CDROM %CDROM1%IF EXIST %CDROM2%\cd.txt setenv /m CDROM %CDROM2%IF EXIST %CDROM3%\cd.txt setenv /m CDROM %CDROM3%IF EXIST %CDROM4%\cd.txt setenv /m CDROM %CDROM4%IF EXIST %CDROM5%\cd.txt setenv /m CDROM %CDROM5%IF EXIST %CDROM6%\cd.txt setenv /m CDROM %CDROM6%IF EXIST %CDROM7%\cd.txt setenv /m CDROM %CDROM7%
@echo off
SET KEY=HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceEx
REG ADD %KEY% /V TITLE /D "Installing Applications from the CDROM" /F
REG ADD %KEY%\001 /VE /D "Preparing Installation..." /FREG ADD %KEY%\001 /V 1 /D "%CDROM%\Software\prepare.cmd" /F............EXIT

with this method however, i was able to minimize which drive letters to look for since it only reports (or adds to the variable) all the optical drives present as

CDROM1=G:

CDROM2=H:

the method i applied was to look for the cd.txt file only at (7 maximum possible) optical drives using the IF EXIST statement.

however, it seems that during the process of the IF EXIST statement, i made some mistake (at the parameters) that i don't know how to fix.

now, once the runonceex.cmd is run during the unattended install, it prompts me for an error

Windows cannot find '\Software\prepare.cmd'. Make sure you typed the name correctly,

and then try again. To search for a file, click the Start button, and then click Search.

i tried peeking at the environment variables being delared, by running cmd.exe during the time the prompt appeared and running setenv. to my surprise, only the CDROMn (the one declared by detectcd2.exe) were the only variables added:

CDROM1=G:

CDROM2=H:

the setenv commands were not declared. however, on one of the combinations i made with setenv (using "%"CDROMn"%" and assigning it to the CDROM variable), it resulted that CDROM variable had a blank designation (when running setenv to check which variables were present). though not present using the plain SET|more command.

i tried lots of variations of both the IF EXIST statement and the setenv command, and all had the same errors.

IF EXIST %CDROM1%\cd.txt setenv /m CDROM %CDROM1%

IF EXIST %CDROM1%\cd.txt (setenv /m CDROM %CDROM1%)

IF EXIST %CDROM1%\cd.txt setenv /m CDROM "%"CDROM1"%"

i originally tried using -m instead of /m but still the same effect, as well as defining it as a user environment (/u -u).

i wonder how i may be able to have a workaround with this? thanks in advanced for your replies.

Link to comment
Share on other sites


i would personally use SETX.EXE . It should do the same thing as SETENV

Link : http://www.microsoft.com/downloads/details...&displaylang=en

Your theory sounds good. I've heard of problems with Zips and whatnot. Why do you need to set a Machine variable? Is it used later on or something?

If SETENV is anything like SETX, then the variable is not available UNTILL you start your next batch, and not before. If you're just using this variable in this batch file, just use SET.

Is %CDROM1% even defined? I'm just curious on this one.

Link to comment
Share on other sites

will try SETX, thanks for the suggestion :)

i would like to use SET to replace setenv, will also try that one.

about using a machine variable, i just made it so (under setenv) because detectcd2 places the CDROMn variable on the machine environment.

i also used setenv because one of the two CMD files i call during the RunOnceEx registry (called at the latter part of the RunOnceEx - cleanup.cmd file) copies some files off the unattended cd.

yup, CDROM1 is defined already as a machine variable during the period where i encountered the error Windows cannot find '\Software\prepare.cmd'.....

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