Solved

Batch file to save current drive letter into a variable

Posted on 2006-07-13
3
3,899 Views
Last Modified: 2012-05-05
I would like to be able to do something like this: command %driveletter% . Any help is appreciated.

Thanks!
0
Comment
Question by:gromul
3 Comments
 
LVL 4

Accepted Solution

by:
rage419 earned 500 total points
ID: 17105353
How about using the %cd% variable and set? Seems to work...

set bob=%cd:~0,1%

0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 17106326
Or for NT4 I have had to use this as %CD% doesn't work until 2000 (which therefore works on NT/2000/XP/2003):

for /f "tokens=*" %A in ('CD') do set DRIVE=%~dA
0
 
LVL 8

Expert Comment

by:Here2Help
ID: 17109713
Hey.

If you are using XP you can use these:

%Homepath%
%Systemdrive%
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now