Help on DOS needed!
Hi, I have a website that runs of the CD that I distribute to clients. I have given a provision for the user to copy all the files to the user's hard disk and run from there. The link in the webpage calls up a dos batch file that looks like this: setup.
Hi,
I have a website that runs of the CD that I distribute to clients. I have given a provision for the user to copy all the files to the user's hard disk and run from there. The link in the webpage calls up a dos batch file that looks like this:
setup.bat
----------
md c:\Website
xcopy *.* /h /s c:\Website
del c:\Website\SETUP.BAT
The problem is that the xcopy command sometimes copies the contents to the desktop. SO I need to substitute the drive letter of the CD Drive from where the batch file is run.
Like xcopy [CD DriveLetter]:\*.* /h/s c:\Website
How do I identify the Drive Letter of the CD Drive? It is a long time since I worked on DOS environment and I have forgotten variables substitution.
Any help would be gratefully appreciated.
I have a website that runs of the CD that I distribute to clients. I have given a provision for the user to copy all the files to the user's hard disk and run from there. The link in the webpage calls up a dos batch file that looks like this:
setup.bat
----------
md c:\Website
xcopy *.* /h /s c:\Website
del c:\Website\SETUP.BAT
The problem is that the xcopy command sometimes copies the contents to the desktop. SO I need to substitute the drive letter of the CD Drive from where the batch file is run.
Like xcopy [CD DriveLetter]:\*.* /h/s c:\Website
How do I identify the Drive Letter of the CD Drive? It is a long time since I worked on DOS environment and I have forgotten variables substitution.
Any help would be gratefully appreciated.
Participate on our website and join the conversation
This topic is archived. New comments cannot be posted and votes cannot be cast.
Responses to this topic
DosFreak,
Thanks for your reply - however, my question was how to identify the CD Rom Drive letter and NOT the Drive letter of the system where Windows is installed (%SYSTEMDRIVE% returns the drive where Windows is installed, isn't it?).
Or am I missing something?
Thanks again.
Thanks for your reply - however, my question was how to identify the CD Rom Drive letter and NOT the Drive letter of the system where Windows is installed (%SYSTEMDRIVE% returns the drive where Windows is installed, isn't it?).
Or am I missing something?
Thanks again.
Would it not be xcopy D:\ or xcopy D:\>*.* /h /s c:\Website
del c:\Website\SETUP.BAT ? Been a long time since I played in DOS, but doesn't the ">" sign move DOS to that drive, and then carry out any commands after it's there?
Instead of swapping to the drive, then typing the command, I think the ">" fires DOS directly to the command. Obviously, substitute "D" for your CD drive.
It's been such a long time. Is DOS For Dummies out there somewhere online? Sure helped me out way back when.
del c:\Website\SETUP.BAT ? Been a long time since I played in DOS, but doesn't the ">" sign move DOS to that drive, and then carry out any commands after it's there?
Instead of swapping to the drive, then typing the command, I think the ">" fires DOS directly to the command. Obviously, substitute "D" for your CD drive.
It's been such a long time. Is DOS For Dummies out there somewhere online? Sure helped me out way back when.
The %SYSTEMDRIVE% variable is standard on all NT systems and will always be the partition of the Windows that you are currently using. So on a dual-boot system if 9x was C: and NT was D: then %SYSTEMDRIVE% would be D.
You can verify this by going into the command prompt and typing: "SET"
I did this because I'm used to using variables, instead of hardcoding paths. It's more reliable this way.
It's been a long, long time since I last used Windows 9x so I'm unsure what the variable for 9x would be, if there is none then simply go back to C:\. This shouldn't affect anything.
As for determining the CDROM drive that the .bat is being run from...that shouldn't be necessary. When you run the setup.bat from the CD...then you are running the .bat from the CD. You can verify this by placing a PAUSE statement in your batch file and checking the prompt. It should be the CD drive letter that your running it from.
I suppose you could create a variable for all drive letters with \website....but that shouldn't be necessary since it sounds like your batch file finds the files, just that sometimes it copies to the desktop? Can you reproduce this?
You can verify this by going into the command prompt and typing: "SET"
I did this because I'm used to using variables, instead of hardcoding paths. It's more reliable this way.
It's been a long, long time since I last used Windows 9x so I'm unsure what the variable for 9x would be, if there is none then simply go back to C:\. This shouldn't affect anything.
As for determining the CDROM drive that the .bat is being run from...that shouldn't be necessary. When you run the setup.bat from the CD...then you are running the .bat from the CD. You can verify this by placing a PAUSE statement in your batch file and checking the prompt. It should be the CD drive letter that your running it from.
I suppose you could create a variable for all drive letters with \website....but that shouldn't be necessary since it sounds like your batch file finds the files, just that sometimes it copies to the desktop? Can you reproduce this?