How to remove drive letter

M

Mark V

In microsoft.public.win2000.cmdprompt.admin alantang(Anti-Spam)
wrote:
Hello:

Is it possible to remove the drive letter from command line?

What's the context?
A "mapped" drive? Local drive? SUBSTituted drive? ...
From a CMD Prompt?
 
G

Guest

Ohh... Sorry for missing the importation information. The Drive is a
logical drive!
Does "diskpark" can do that? How about "mountvol"?

Thanks!
 
D

Don I

If you mean the prompt shown in the cmd window, it's a variable called
"PROMPT". By default it's set to $p$g which results in showing the full
path to the current location with the greater than symbol. But I don't see
anyway to get rid of the drive letter.

If you're wanting to find out the drive letter that is passed to a batch
file at the command line then that's a different story. And although I'm
sure it can be done, I don't have time right now to get to it. If I find
time later, I'll see what I can come up with.
 
M

Mark V

In microsoft.public.win2000.cmdprompt.admin alantang(Anti-Spam)
wrote:
Ohh... Sorry for missing the importation information. The Drive
is a logical drive!
Does "diskpark" can do that? How about "mountvol"?

All "drive letters" refer to "logical" volumes.

What is it you want to do?
 
A

Al Dunbar [MS-MVP]

Don I said:
If you mean the prompt shown in the cmd window, it's a variable called
"PROMPT". By default it's set to $p$g which results in showing the full
path to the current location with the greater than symbol. But I don't see
anyway to get rid of the drive letter.

If you're wanting to find out the drive letter that is passed to a batch
file at the command line then that's a different story. And although I'm
sure it can be done, I don't have time right now to get to it. If I find
time later, I'll see what I can come up with.

No need:
X:\bats\batfile.bat Z:\data\info\stuff.txt

in batfile.bat:

echo/drive where batch file is located: "%~d0"
echo/drive where data file is located: "%~d1"

/Al
 
D

David Wang [Msft]

I think what the user is asking is:
"assume I have Z: mounted to something, either a UNC share, WebDAV share, or
local partition", how do I remove Z: from the mapping [so that I can use it
for something else]"

To remove a UNC or WebDAV share, use:
NET USE Z: /d
To remove a Z: mapping to a local partition:
- On W2K, use:
mountvol Z: /d
- On WXP/WS03, use DISKPART:
diskpart
list volume
select volume # (find the volume # corresponding to the drive letter in
interest)
remove

--
//David
IIS
http://blogs.msdn.com/David.Wang
This posting is provided "AS IS" with no warranties, and confers no rights.
//

Don I said:
If you mean the prompt shown in the cmd window, it's a variable called
"PROMPT". By default it's set to $p$g which results in showing the full
path to the current location with the greater than symbol. But I don't see
anyway to get rid of the drive letter.

If you're wanting to find out the drive letter that is passed to a batch
file at the command line then that's a different story. And although I'm
sure it can be done, I don't have time right now to get to it. If I find
time later, I'll see what I can come up with.

No need:
X:\bats\batfile.bat Z:\data\info\stuff.txt

in batfile.bat:

echo/drive where batch file is located: "%~d0"
echo/drive where data file is located: "%~d1"

/Al
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top