Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 04-16-2005, 11:40 AM   #1
Beta Member
 
Join Date: Apr 2005
Posts: 3
Default Batch File copy - help needed

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
__________________

Bladerunner is offline   Reply With Quote
Old 04-16-2005, 07:19 PM   #2
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,003
Default Re: Batch File copy - help needed

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)!
__________________

root is offline   Reply With Quote
Old 04-17-2005, 05:01 PM   #3
Beta Member
 
Join Date: Apr 2005
Posts: 3
Default 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
Bladerunner is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 12:34 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0