Batch File copy - help needed

Status
Not open for further replies.

Bladerunner2019

Solid State Member
Messages
7
Hi

Heres an example of the code im using at the moment:

rem

cd c:\
md Example

cd c:\Example

xcopy "C:\Documents and Settings\User\My Documents\Test\Example" "C:\Example" /s

c:\Example\SpaceMonger.exe


As you can see, it creates an empty 'Example' folder on the root of C:, then copies the contents of 'Example' from the 'My Documents folder into the newly created folder on C:, and executes the exe 'SpaceMonger.exe'.
I've created a shortcut to the Batch file, and this works fine using the above syntax.

However, once its burnt on CD (the shortcut to the Batch file is on an autorun html page with other shortcuts to other apps), I obviously cannot specify the path as C: in xcopy where its coming from (where its copying to will remain constant).
The problem is that CD Rom drive letters will vary, so is there a way to tell it to look in the "<CD Rom>\Test\Example" folder? I.E., some syntax that specifies the CD Rom on any machine, irrespective of its drive letter?

If anyone can help I would be most appreciative.

TIA
 
The only way I could think of would be to output the msinfo32 data to a text file, then use find.exe to scan for the CD drive.

The only problem is that on most machines it takes over a minute to generate the entier msinfo32 output :/
 
Thanks to those that replied.
I've now solved it; it was as simple as ommiting the path altogether, so instead of:

rem

cd c:\
md Example

cd c:\Example

xcopy "C:\Documents and Settings\Wilcee\My Documents\Test\Example\SpaceMonger.exe" "c:\Example" /s

c:\Example\SpaceMonger.exe


I changed the script to the following:

rem

cd c:\
md Example

cd c:\Example

xcopy "Example\SpaceMonger.exe" "c:\Example" /s

c:\Example\SpaceMonger.exe


It now works like a charm, no matter what CD Rom I use & no matter what the drive letter is :D
 
Status
Not open for further replies.
Back
Top Bottom