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.

Legacy OS 455 This topic was started by ,



data/avatar/default/avatar22.webp

60 Posts
Location -
Joined 2001-05-16
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.

Participate on our website and join the conversation

You have already an account on our website? Use the link below to login.
Login
Create a new user account. Registration is free and takes only a few seconds.
Register
This topic is archived. New comments cannot be posted and votes cannot be cast.

Responses to this topic



data/avatar/default/avatar39.webp

3867 Posts
Location -
Joined 2000-02-04
Why not?
 
setup.bat
 
xcopy /I /H /S website %SYSTEMDRIVE%\website
del %SYSTEMDRIVE%\website\setup.bat
 
 
This assumes setup.bat is in the root of the CD and website is a subdir on the CD.


data/avatar/default/avatar22.webp

60 Posts
Location -
Joined 2001-05-16
OP
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.


data/avatar/default/avatar16.webp

513 Posts
Location -
Joined 2005-02-12
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.


data/avatar/default/avatar39.webp

3867 Posts
Location -
Joined 2000-02-04
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?