Options
Batch file query
Hi, just wondered if anybody knew much about batch files. What I'm trying to do is to enter a few lines of coding to a batch file which will be put on a CD. My lines of coding when run will delete a file and then copy in a new file from the CD. This is straight forward enough for example:
@echo off
cls
DEL "C:\Users\DanielSpencer\Desktop\01.bmp"
COPY "F:\Guides\Guide for DP\02.bmp" ""C:\Users\DanielSpencer\Desktop"
Pause
However the CDs would need to be sent out to a number of different computers which may be using different drive letters for the optical drive. However I very little about batch files so don't know how to code it so that it finds the file to be copied regardless of what drive letter is used for the CD. If anybody has any ideas it would be appreciated.
@echo off
cls
DEL "C:\Users\DanielSpencer\Desktop\01.bmp"
COPY "F:\Guides\Guide for DP\02.bmp" ""C:\Users\DanielSpencer\Desktop"
Pause
However the CDs would need to be sent out to a number of different computers which may be using different drive letters for the optical drive. However I very little about batch files so don't know how to code it so that it finds the file to be copied regardless of what drive letter is used for the CD. If anybody has any ideas it would be appreciated.
Comments
-
OptionsDevilsbane Member Posts: 4,214 ■■■■■■■■□□%username% is your friend, otherwise %userprofile% can be used if the script you're writing will be used on both xp (documents and settings) and 7 (users).
Go to a command prompt and type in set to see a listing of all of the variables that are currently set up. You can also use the set command to create new variables.Decide what to be and go be it.