Jump to content

system variable for cdrom


Recommended Posts

Ok I have made a Windows XP self install disk, I would like to put a short cut or way to access a folder (Extras) on my install disk on the desktop.

The source of the folder is "cdrom\I386\Extras", Now the first thing I tried was I put a short cut to "D:\I386\Extras" in the $OEM$ which worked just fine

till I installed my disk on a computer that that a few hard drives in it. The D:\ was given to the slave drive then making the short cut on the desktop not work.

Is there a system variable for the cdrom ? if so I could make a batch script name Extras on the desktop that would open the folder on the disk

The batch script would look something like this

start "cdrom variable\I386\Extras"

now if there is not a cdrom variable anyone elsse got a good idea on how to do this?

Edited by JayDogg
Link to comment
Share on other sites


I did see that already but I dont understand it really, from what I have read in that thread if you put

SET CDROM=%CD:~0,2% in CMDLINES.TXT which is in my $OEM$

it will make the CDROM letter be F:\

Is that right?

And if it is how would I name the CDROM Z?

and my CMDLINES.TXT looks like this

[Commands]

"rundll32 advpack.dll,LaunchINFSection nLite.inf,U"

now how would I add the SET CDROM=%CD:~0,2% into that

would it be

[Commands]

"rundll32 advpack.dll,LaunchINFSection nLite.inf,U"

"SET CDROM=%CD:~0,2%"

or would it be

[Commands]

"rundll32 advpack.dll,LaunchINFSection nLite.inf,U SET CDROM=%CD:~0,2%"

Link to comment
Share on other sites

The post I linked to didn't say that at all. It said:

There is a much simpler way. Have a unique file on your CD, and look for it:

@echo off

for %%a in (C 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 %%a:\path\to\yourfile.xyz set CDROM=%%a

(where \path\to\yourfile.xyz is the path to your uniquely named file called yourfile.xyz or whatever it might be, with no drive letter of course)

I use GUIRunOnce to start command.cmd, after that, command.cmd uses that code to find the CD Rom drive letter, and starts %CDROM\whatever.cmd that does the installs directly from the CD (Actually, a DVD-R but that's besides the point). Simple to do and works reliably at every stage.

It doesn't get any easier than this...

Link to comment
Share on other sites

Im not following what that does for me sorry but Im a little new at all this. If you dont mind how could I use that to make a short cut on my desktop that opens the folder "cdrom\I386\Extras" or set the CDROM to the same letter ever install

really all I want is a short cut that drops on to my desktop while xp installs that opens "cdrom\I386\Extras"

Edited by JayDogg
Link to comment
Share on other sites

The classic approach:

@echo off
set directory=variable\I386\Extras
for %%a in (C 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 %%a:\%directory% start "%%a:\%directory%"

Added:

Now the first thing I tried was I put a short cut to "D:\I386\Extras" in the $OEM$ which worked just fine

I don't understand clearly: How do you create a short cut?

A environment variable approach: cmdlines.txt

[COMMANDS]
CDROM.cmd

CDROM.cmd

reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v "CDROM" /t REG_SZ /d "%~d0" /f

Environment variable valid after boot.

Or use setx.exe http://support.microsoft.com/kb/927229

Environment variable is active imediately.

Edited by cdob
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...