Jump to content

Recommended Posts

Posted

Method 1

Create a file called cdrom.cmd, and put it in the $OEM$ directory of your unattended cd. In cdrom.cmd put:

echo set cdrom=%cd:~0,2%>>%systemdrive%\autoexec.bat

Save the file. Now add:

"cdrom.cmd"

to your cmdlines.txt file.

This method will return your CD-ROM drive as system variable %cdrom% in the format of “X:”

Note: The system variable %cdrom% will not be available until the computer restarts. If you are only doing it for RunOnceEx, it should work just fine.

Method 2

Get setx.exe from your XP cd under “X:\support\tools\support.cab”, and put it in “$OEM\$$\System32” folder. In your cmdlines.txt, add:

"setx cdrom -k HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Setup\SourcePath"

This method will return your CD-ROM drive as system variable %cdrom% in the format of “X:\”

Final note: These methods will only work if you install windows from a CD.


Guest zippy
Posted

FOR /F "skip=4 tokens=3" %I IN ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "SourcePath"') DO (
 SETX CDFullPath "%~I"
 SETX CDDrive "%~dI"
 SETX CDPath "%~pI"
)

found in someone else's post here...long time ago.

Posted
Why do that when just plain %cd% works  :)

His method works on either the hd, or cdrom, where the %CD% only works on the cdrom.

If it is only effective on the cdrom, then you might as well use %~d0 in your script.

Posted
Why do that when just plain %cd% works  :rolleyes:

His method works on either the hd, or cdrom, where the %CD% only works on the cdrom.

If it is only effective on the cdrom, then you might as well use %~d0 in your script.

%cd% means current directory!

It will give the path to where ever you call it from.

It is universal.

Please try things before saying it won't work as people browse this forum and take information as fact. :)

Posted
Why do that when just plain %cd% works  :rolleyes:

His method works on either the hd, or cdrom, where the %CD% only works on the cdrom.

If it is only effective on the cdrom, then you might as well use %~d0 in your script.

%cd% means current directory!

It will give the path to where ever you call it from.

It is universal.

Please try things before saying it won't work as people browse this forum and take information as fact. :)

So let me get this straight, %CD% gives you the current directory from where you call it. Which means something will have to call this script from the cdrom (cmdlines).

zippy's method can be called from the cdrom (cmdlines), or hd (runonce).

Sure you can put the cmd anywhere you want, but if you are calling it from cmdlines, what is the point of having the cmd on the hd?

If you are going to be calling it from the cdrom, then leave the cmd file on the cdrom, and you can use %~d0. If you want the path, %~dp0.

Also I didn't say it wouldn't work. Just trying to understand your logic.

Posted

edmoncu -

So with DetectCD2 I would just add some thing like so to the cmdlines.txt:

[COMMANDS]
"CMD DetectCD2 /C"

Then %cdrom1% and %cdrom2% values would be useable for the likes of runonceEX...so I could then use some thing like:

REG ADD %KEY%\015 /V 1 /D "%CDROM1%\Software\AdobeReader\AR6.msi /qn" /f

Or am I missing some thing?

Also where should it be placed?

$OEM$ or $OEM$\$$\SYSTEM32 hehe or else where?

Posted

i use the plain jane method:

for %%i in (C: D: E: F: G: H: I: J: K: L:) do if exist %%i\nLite.log set CDROM=%%i

I use nLite obviously, and don't delete the log file

Posted

[bM]Crusher -

Now I'm taking a bit of a stab in the dark here...but I'm guessing that fuctions the same as:

cmdow @ /HID
@echo off
set tagfile=\WIN51

IF EXIST C:%tagfile% SET CDDRIVE=C:
IF EXIST D:%tagfile% SET CDDRIVE=D:
IF EXIST E:%tagfile% SET CDDRIVE=E:
...

In which case I suffer from a issue and thats hdd's (raid) showing up post the execution of that code...which then bumps the cdrom to a different value...but its not reflected in the code.

Tho I do run that code from RunOnceEX.cmd....maybe I should have it placed else where...well thanks for you time thus far...and any working answers are more than welcome. :)

Posted

So let me get this straight, %CD% gives you the current directory from where you call it. Which means something will have to call this script from the cdrom (cmdlines).

zippy's method can be called from the cdrom (cmdlines), or hd (runonce).

Sure you can put the cmd anywhere you want, but if you are calling it from cmdlines, what is the point of having the cmd on the hd?

If you are going to be calling it from the cdrom, then leave the cmd file on the cdrom, and you can use %~d0. If you want the path, %~dp0.

Also I didn't say it wouldn't work. Just trying to understand your logic.

Yes you call it from cmdlines but it injects it into the registry at the 13min mark.

So when run once runs (from the hard drive) it has the letter from the cd cause it originally called from cmdlines.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

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