Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Batch File copy - help needed
Closed Thread
Old 04-16-2005, 03:38 PM   #1 (permalink)
 
Newb Techie

Join Date: Apr 2005

Posts: 4

Bladerunner2019

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" "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
Bladerunner2019 is offline  
Old 04-16-2005, 04:32 PM   #2 (permalink)
 
Monster Techie

Join Date: May 2004

Location: /usr/root/mn/us

Posts: 1,121

bla!! is on a distinguished road

Default

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 :/
__________________
<br>
Its a frigging Laptop, not a Labtop!!!!
bla!! is offline  
Old 04-16-2005, 05:25 PM   #3 (permalink)
 
Wizard Techie

Join Date: Jul 2003

Posts: 3,940

ekÆsine

Default

I'm not certain exactly how it would be done, but to do what you want requires mscdex. you would specify something like /D:MSCD001 or /L:%CDROM%

more help:
http://www.computerhope.com/mscdex.htm
ekÆsine is offline  
Old 04-17-2005, 04:55 PM   #4 (permalink)
 
Newb Techie

Join Date: Apr 2005

Posts: 4

Bladerunner2019

Default

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
Bladerunner2019 is offline  
 
Closed Thread

Thread Tools
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 On