There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
blue screen boot bsod computer connection crash css dell display driver drivers email error ethernet excel firefox firefox 3 game hard drive hardware internet internet explorer itunes laptop lcd malware monitor network networking outlook outlook 2003 outlook express partition password printer problem problems router security slow sound sprtcmd.exe trojan usb video virus vista windows windows xp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
Need help with Batch


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
Biggy1982's Avatar
Junior Member with 2 posts.
 
Join Date: Oct 2005
13-Oct-2005, 06:16 AM #1
Need help with Batch
Hello, i dont know if what i want is posible or not but heres what i want to do and need help with doing.

I want to copy files and directories from a CD-rom to the C: drive.
This is not witch is hard, here comes the twist in my ear, The batch file will be ON the cd and so can not be edited, the CD has to be usable on anny computer.

Normaly if one makes a batch you do copy d:\files\*.* C:\files
D in this case being the CD-rom, but since not everyone has the D as cd-rom, i cant do it this way.

Recap: How to copy files in a dir on a cd to the C drive without being able to specifie the exact source path.
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 6,589 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
13-Oct-2005, 06:58 AM #2
You could ask the user to enter their CD drive number.
Biggy1982's Avatar
Junior Member with 2 posts.
 
Join Date: Oct 2005
17-Oct-2005, 05:45 AM #3
like... huh?
So how do i encorperate the asking of the CD drive in a batch?
Ow and keep in mind the people that us this wont see the batch file, all they see is a picture.
We are going out from the point of users that hardly know what a keyboard is.
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 6,589 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
17-Oct-2005, 08:33 AM #4
Most batch file programs have a user input, what batch file program are you using?
aewarnick's Avatar
Senior Member with 839 posts.
 
Join Date: Sep 2002
17-Oct-2005, 08:56 AM #5
If the batch file is on the cd, just put it in the root of the cd and copy the files without a full path:

copy "Folder\file.exe" "c:\"
StumpedTechy's Avatar
Distinguished Member with 6,142 posts.
 
Join Date: Jul 2004
Location: Central Florida
Experience: Advanced
17-Oct-2005, 02:11 PM #6
I have a trick that works every time -

for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%a:\file.ext set CDROM=%%a

What I normally do is create a "dummy" file and call it CD.ID and put it on the root of the CD rom.

then in the batch file put everything as %CDROM%:\directory\directory\file.ext and %CDROM% will then the %CDROM% will point back to the token.

ONE WORD OF WARNING -

MAKE SURE THIS FILE YOUR SEARCHING FOR DOES NOT EXIST ON ANY OTHER DRIVE ROOT OR IT MAY PICK UP THAT DRIVE INSTEAD.

I.E. if you change

for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%a:\file.ext set CDROM=%%a

to be -

for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%a:\Autoexec.bat set CDROM=%%a
and there is an Autoexec.bat on your C:\drive then your going to get your C:\ as your token and not the CD-Rom (hence why I use a dummy CD.ID file)
Squashman's Avatar
Distinguished Member with 12,700 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
17-Oct-2005, 07:33 PM #7
Quote:
Originally Posted by aewarnick
If the batch file is on the cd, just put it in the root of the cd and copy the files without a full path:

copy "Folder\file.exe" "c:\"
exactly. If it is running from the cd drive you would not need to use the full path with the drive letter.

I found something Similare to what Stumpy posted. It is just another batch file called FindCD.

http://www.nu2.nu/utils/
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 09:24 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.