Jump to content

Reassigning drive letters automatically


Recommended Posts


Thanks mdes... I really should learn to try the obvious, and read the info in the .cmd!!! After reading it... it more than answered a couple of my questions!!!!

One final question (honestly!)... is it possible to implement the functionality of CMDOW (http://www.commandline.co.uk/cmdow/) to eliminate, or reduce the popup/dos windows???

Thanks.... now that it all workin fine, I couldnt imagine my Unattended disk without it... CHEERS!

Link to comment
Share on other sites

One final question (honestly!)... is it possible to implement the functionality of CMDOW (http://www.commandline.co.uk/cmdow/) to eliminate, or reduce the popup/dos windows???
Yes, but I already added "/MIN" in the lastest version, so the DOS batch windows will be minimized: in case of problem, you will know where it occured!

ps: I am also using CMDOW in my unattended installation, but not with MAPDRIVE.CMD!

Link to comment
Share on other sites

I tried to add cmdow commands, but it didn't exactly work the first, and didn't feel like messing with it too much, so I'll leave it.

Thanks for a great script. I only hope you get around to integrating reader/writer checking sometime soon.

Link to comment
Share on other sites

  • 3 weeks later...

I hope that people still read this topic.

I use this wonderful script in my unattended setup. It does exactly what I want it to do, but I have a small problem that the script may easily take care of also. My other problem is that I have reached my DOS scripting limit, so I hope someone may be able to throw a suggestion.

I have a card reader that shows as 4 Removable Drives. I would like to make them disappear from my list. The script removes all drive letters anyway and then re-assigns them, so I need some assistance in telling it to not re-assign letters to removable drives.

Any help in inserting the appropriate code would be appreciated.

Link to comment
Share on other sites

I have a card reader that shows as 4 Removable Drives. I would like to make them disappear from my list. The script removes all drive letters anyway and then re-assigns them, so I need some assistance in telling it to not re-assign letters to removable drives.

Any help in inserting the appropriate code would be appreciated.

Did you try the last version (2005/11/04), I didn't deassign letters that don't need to be changed.
Link to comment
Share on other sites

Did you try the last version (2005/11/04), I didn't deassign letters that don't need to be changed.

Thank you for the response, Mdes.

Yes, I am using the latest version. What I want to do is de-assign the Removable drive letters permanently. I was looking for a script that simply de-assigns all removable drives, but then I discovered your script and I thought that I can combine my requirement to it.

I could do it manually I suppose, but your script already has the code. I suppose that I only need to insert a check to see if the drive is Removable and de-assign it before moving to the next drive, but as I said, your script is a little beyond my capabilities. Any suggestions?

Link to comment
Share on other sites

@ECHO OFF
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
ECHO RESCAN >TMP_LISTVOL.TXT
ECHO LIST VOLUME >>TMP_LISTVOL.TXT
ECHO EXIT >>TMP_LISTVOL.TXT
START "Listing volumes" /WAIT /MIN CMD /C "DISKPART /s TMP_LISTVOL.TXT | MORE | FINDSTR /R /C:"^ *Volume [0-9][0-9]*" >TMP_LISTVOL.LOG"
DEL TMP_LISTVOL.TXT

FOR /F "usebackq delims=:" %%V IN (TMP_LISTVOL.LOG) DO (
SET LINE=%%V

SET VOLUME=!LINE:~2,9!
SET TMP_OLD_LETTER=!LINE:~15,1!
SET VOLTYPE=!LINE:~39,9!
SET VOLINFO=!LINE:~71,8!
SET VOLNAME=!LINE:~19,11!

IF "!VOLTYPE!" == "REMOVABLE" (
ECHO SELECT !VOLUME! >TMP_TEST1VOL.TXT
ECHO REMOVE NOERR
)
)
ECHO EXIT >>TMP_TEST1VOL.TXT
START "Deassign Removable Drives" /WAIT /MIN CMD /C "DISKPART /s TMP_TEST1VOL.TXT
DEL >>TMP_TEST1VOL.TXT

Note that some space could be inserted before REMOVABLE => " REMOVABLE" or " REMOVABLE" or ...

Type in a DOX box:

DISKPART
LIST VOLUME
EXIT

and see what to put...

I've not tested it ;)

Link to comment
Share on other sites

Awesome! Thank you Mdes, it works like a charm! I only had to correct a couple of syntax errors but it was easy.

This also explained how delims and tokens work. Double bonus! Thank you again.

Link to comment
Share on other sites

Oops... Here it is.

@CMDOW.EXE @ /HID
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION

SET Confirm=1

ECHO RESCAN > TMP_LISTVOL.TXT
ECHO LIST VOLUME >> TMP_LISTVOL.TXT
ECHO EXIT >> TMP_LISTVOL.TXT
START "Listing volumes" /WAIT /MIN CMD /C "DISKPART /s TMP_LISTVOL.TXT | MORE | FINDSTR /R /C:"^ *Volume [0-9][0-9]*" >TMP_LISTVOL.LOG"
DEL TMP_LISTVOL.TXT

FOR /F "usebackq delims=:" %%V IN (TMP_LISTVOL.LOG) DO (
SET LINE=%%V
SET VOLUME=!LINE:~2,9!
SET TMP_OLD_LETTER=!LINE:~15,1!
SET VOLTYPE=!LINE:~39,10!
SET VOLINFO=!LINE:~71,8!
SET VOLNAME=!LINE:~19,11!
IF "!VOLTYPE!" == "Removeable" (
ECHO SELECT !VOLUME! >> TMP_TEST1VOL.TXT
ECHO REMOVE NOERR >> TMP_TEST1VOL.TXT
)
)
ECHO EXIT >>TMP_TEST1VOL.TXT
IF %Confirm%==1 (
START "Deassign Removable Drives" /WAIT /MIN CMD /C "DISKPART /s TMP_TEST1VOL.TXT
DEL TMP_TEST1VOL.TXT
DEL TMP_LISTVOL.LOG
)
EXIT

I changed

SET VOLTYPE=!LINE:~39,9!

to

SET VOLTYPE=!LINE:~39,10!

and at the end,

DEL >>TMP_TEST1VOL.TXT to DEL TMP_LISTVOL.LOG

Oh, and I inserted a confirmation flag for testing purposes.

Thank you again for Drive Map and this.

Edited by No6
Link to comment
Share on other sites

  • 11 months later...

Hello.

I'm new here. And I hope that someone can help me with my problem and that anyone still follows this thread after so long time.

When I use DriveMap with cmdlines.txt it never changes my driveletters. It starts running an but then it stops without any changes. I can just read some access denied messages flashing and the cmd window closes.

I have the MapDrive.cmd in the $OEM$ directory and run it with "MapDrive.cmd DEU" from cmdlines.txt.

Whe I use it on the running system afterward it runs without a problem.

Has anyone an idea what ist going wrong?

Link to comment
Share on other sites

Hi kamizoli,

Could you run it as

MapDrive.cmd DEU TEST LogPath

and send me the resulting log file TMP_MAPDRIVE_date_time.LOG? (LogPath = C:\ or whatever)

Michel

Edited by mdes
Link to comment
Share on other sites

  • 2 months later...

Hi mdes,

I'm struggling with drive letters assignment and raised my question in the German nLite forum.

Another member was so kind to link to your thread here in the MSFN forum.

I want to integrate your mapdrive-cmd. tool into my nLite Custom CD for Win XP.

I have already W2K installed on a system partition of my first IDE harddisk which consists of three partitions now, e.g. 3 drive letters.

I have also one raid-1 system (1 drive letter) two optical drives (2 drive letters) and a cardreader with four (virtual) drives installed (4 drive letters).

I created an nLite-CD and installed WinXP in the third partition of the IDE-harddisk. However, WinXP assigns the drive letters not in series, but I want the order on the IDE-drive as follows: C: "W2K_SYSTEM", D: "DATA" and F: "WIN_XP". (E: is used for the RAID-drive).

When the installation procedure was terminated, WinXP assigned J: to the "WIN_XP"-partition. I cannot rename the "WIN_XP" system partition, as WinXP refused to rename the system partition, of course.

As you are experienced with this business, can you tell me whether

  • your program is able to reassign system drives also after installation had been finished?
  • I have to do this prior to install WinXP, e.g. integration of your program into the custom installation CD in unattended mode?

Maybe other member can give me some help.

Thanks so far

Aemetz

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...