Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Batch file help-xcopy command perhaps?  (Read 3617 times)

0 Members and 1 Guest are viewing this topic.

Indignity

  • Guest
Batch file help-xcopy command perhaps?
« on: March 07, 2005, 07:49:49 AM »
First off... ello! Great to have a community like this!

I'll try and explain this as simply as possible and provide as much detail as I can.

I am creating an application CD to house a bunch of applications that I use on a routine basis. I have no trouble with any of the applications. The issue I am having is with external plugins or other dll's to add into the applications. 99% of the time, I will be installing this on a WindowsXP install.

My thought was to create a batch file to copy the contents of a directory on the CD into a situation like this: C:\Program Files\Stupid Program\Plugins

Now, here's the issue.... Since this will be a CD that I might want to install on multiple PCs, using XCOPY, the source might be different (ie. drive "D:\" being the default CD drive usually).

Is there a command that will allow me to utilize the CD drive depending upon it's drive designation or perhaps prompt the user to input the CD drive letter & use that to copy over the contents? If so, would it be possible to post a sample of the commands? I'm a newb to advance batch file functions, so please be nice :D

Thanks in advance for your time & help!

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: Batch file help-xcopy command perhaps?
« Reply #1 on: March 08, 2005, 06:16:07 AM »
The possibilites are endless.

You can use brute force and simply pass the CD drive letter along the command line (ex: myfile CDROMdrive). Use the %1 variable in place of the hardcoded drive letter in your batch file.

You can use the KISS method and have the batch file prompt you for the drive (ex: set /p cdrom=Enter drive letter of the CD). Use the %CDROM% variable in place of the of the hardcoded drive letter in your batch file.

You can use the Is This Cool Or What? method and write a Windows Script, loop over the drives collection, find the CD device type, extract the corresponding drive letter and use that in place of a hardcoded drive letter.

Personally, the KISS method generally is the way to go.

Good luck.  8)
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein

Indignity

  • Guest
Re: Batch file help-xcopy command perhaps?
« Reply #2 on: March 09, 2005, 01:28:01 PM »
Thanks for posting Sidewinder!!! Appreciate that!

The KISS method is what I figured I'd need to utilize to accomplish this. There is noooo way I'm going to touch Windows scripting right now unless there is a compiler that guides you through composing one.

So, in essence, this should work for me then? (keep in mind, i'm just looking for the function of copying the directory from the cd to the plugin directory on the hard drive).

Code: [Select]

set /p userin=Please Enter Your CD-rom Drive Letter and Press Enter:

xcopy /s %userin%:\plugins C:\Stupid Program\Plugins


Appreciate the time once again!
« Last Edit: March 09, 2005, 01:40:08 PM by Indignity »

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: Batch file help-xcopy command perhaps?
« Reply #3 on: March 09, 2005, 04:47:52 PM »
Your code will work just fine. BTW: Windows Script does not need a compiler. It's interpreted, and the interpreter is included with all flavors of Windows.

8)
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein