Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Want to know the drive during DOS batch execution 1

Status
Not open for further replies.

bobmie

Programmer
Oct 22, 2005
16
0
0
BE
hello
I run a DOS batch file in the DOS environment of W2000 (also under Windows XP ) and I want to know the drive in which my DOS batch file as started
Are there DOS commands to determine the driveletter ?
Thanks in advance Bob
 
Vol will give you the current drive that is active. or you could change it in the batch file.
 
sorry franklin97355
First thanks for your reply but :I did not correctly formulate my problem .
I want to determine the driveletter during startup of the batch file and put it in a variable .
With this variable the routing in the batchfile can then be choosen
bob
 
Vol will give you the drive letter and then you can parse the line to put it in a variable.
 
hey franklin97355
I know the technique of parsing .. and I know how to write that in Clipper Fortran VB 6 but not how this is written in the DOSlanguage.
Can you send me a example to put the result of the parsing in my variable %drove%
%drove%:\d_beheer\intern\exestore\kuze_n.exe
thanks for your help
bob
 
Hi, Bobmie

I think the following little bat file will give you what you want:

cd>curdir.txt
set /p curd=<curdir.txt
set drive=%curd:~0,1%

This will put the current drive and path in an evironment variable called curd and the current drive letter in one called drive.

This will work only with the cmd.exe command interpreter (not command.com).

Jock
 
Thanks Jock
This works and is now running ! !
I am grateful
Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top