PC Review


Reply
Thread Tools Rate Thread

Convert/Resolve Volume name to Drive letter

 
 
danielm
Guest
Posts: n/a
 
      2nd Apr 2007
Since I did not see this done anywhere in a simple way I've written
this up .
I see google is wrapping text so I hope this comes over readable...

Feel free to improve.
danielm A@T citenet DOT net


[START OF FILE]=====================================================

Since I did not see this done anywhere in a simple way I've written
this up .

Feel free to improve.
danielm A@T citenet DOT net


[START OF FILE]=====================================================

@Echo off
REM File created by (E-Mail Removed). Daniel Moscovitch.
2007/03/31 . Version 1.0#
REM FOR NON COMMERCIAL USE ONLY. Email for other uses.
REM Please credit if used and email me if you've improved it
REM
REM ONLY FOR WINDOWS XP. Requires Administrative rights as far as I
know for diskpart.exe command.
REM This script will find and return the drive letter of the drive
that matches the NAME given.
REM In this case "FLASHHDD" . This volume name should be very uniq and
not short, to avoid mistakes.
REM If your Volumename matches more than one text entry in the volume
dump it will choose the last matching drive entry.
REM Change the name "FLASHHDD" to what you want as volume name of your
device
REM Volume name can be supplied on command line. 1 word only. Test
with something randome to see list.

REM Create the script file for diskpart
echo list volume > VOLLIST.SCP

REM This runs the script and outputs the data to that file.
IF %1.==. (
diskpart /s VOLLIST.SCP | find /i "FLASHHDD" > VOLLIST.TXT
) ELSE (
diskpart /s VOLLIST.SCP | find /i "%1" > VOLLIST.TXT
)

REM Setup evironment variable for drive letter.
SET FLASHDRIVE=
For /F " tokens=3 " %%I in (VOLLIST.TXT) do SET FLASHDRIVE=%%I:
if NOT DEFINED FLASHDRIVE goto NOTFOUND

REM ***************** ***************** *****************
***************** *****************
REM YOUR COMMANDS GO HERE!!!!!! Using %FLASHDRIVE%. ie. Dir
%FLASHDRIVE% .
echo TEST My Flashdrive is on drive %FLASHDRIVE%
echo %FLASHDRIVE%
pause
REM ***************** ***************** *****************
***************** *****************

GOTO CLEANUP

:NOTFOUND
ECHO ***DRIVE VOLUME NOT FOUND. Here is a list...
diskpart /s VOLLIST.SCP
pause

:CLEANUP
del VOLLIST.SCP
del VOLLIST.TXT
SET FLASHDRIVE=

:END


[END OF FILE]=====================================================

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Batch file to convert volume name to drive letter danielm Windows XP General 0 2nd Apr 2007 04:46 PM
Changing boot volume or system volume drive letter =?Utf-8?B?RGls?= Windows XP General 4 7th Feb 2006 04:44 AM
Second drive letter for boot volume Microsoft Windows 2000 Terminal Server Clients 2 30th Jan 2004 03:15 PM
Changing volume drive letter of OS Windows XP General 0 21st Jan 2004 06:15 PM
System volume drive letter Carlos Corredoura Windows XP Basics 1 7th Aug 2003 06:37 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:13 AM.