Batch File copy - help needed

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\SpaceMonger.exe" "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 it.
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 easieet way to do it would be to either, Lauch the cmd file as an autorun action, with a switch to run the script.

eg:
autorun file
[autorun]
cdcmd /C start.bat

then the cdcmd (a copy of cmd.exe on the root) will be executed, when it lunches the prompt will be in the same directory it launches from, so you can copy your file from the root of thecd to the location you want...

a second way to do it would be to use VBscript.

or you could make integrate the batch file into a proper application, perhaps nothing too fancy, but something that'l look good for your autorun CD. (at least a lot betyter than a batch file running)!
 
Solved it!

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
 
Back
Top Bottom