mdes Posted April 18, 2004 Posted April 18, 2004 (edited) Here is the batch description::: -------------------------------------------------------------------------------:: MapDrive.cmd: Assign letters to Drives:: ------------:: Purpose: Automatic assignement of new letter to drives without reboot.:::: Parameters::: ----------:: 1. Language ID (ENU, FRA, DEU, NLD,...). No default value, mandatory.:: 2. TEST to do everything except the drives de/re-assignment. The log file:: TMP_MAPDRIVE_date_time.LOG is created: you can display it to see the expected assignments.:: The environment variables TMP_VOLDESC- show the assignments to be done.:: 3. TempPath : Path where temporary files will be created. Default is current directory.:: Path could be enclosed in quotes and could terminated by a backslsh.:: This is the 2d parameter if the 1st one (TEST) is omitted.:::: Why this program?:: ----------------:: Because during unattended Windows installation, I didn't want to reassign:: manually my drives (S: for Save, W: for my CD Writer, V: for my DVD, T: for:: temporary data, U: for backups, G: for games,...):::: How to use it?:: -------------:: 1. Create a file DRIVE.x on each drive to be reassigned as x:.:: 2. On the system drive, create a file CDR.x where x is the letter to assign:: the the CD reader[/writer]. For unattended installation, create this file:: in $OEM$\$1\.:: 3. In the same way, create a file DVD.x for the DVD reader[/writer] on the system drive.:: 4. On the system drive, create a DRIVE-.x for each letter x that you don't want:: to be assigned (= reserved letters for USB Key,...).:: 5. For unattended Windows installation, (FRA for French,...):: add these lines in the file RunOnceEx.cmd:: (they should be modified according to your situation)::: SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx:: REG ADD %KEY%\001 /VE /D "Modifying Drives Letters" /f:: REG ADD %KEY%\001 /V 1 /D "%SystemDrive%\Install\MapDrive.cmd FRA >%SystemDrive%\MapDrive.log 2>&1" /f:: or add one of these lines in CMDLINES.TXT (under [COMMANDS])::: "MapDrive.cmd FRA %SystemDrive%\Temp >%SystemDrive%\Temp":: "MapDrive.cmd FRA TEST %SystemDrive%\Temp >%SystemDrive%\Temp":::: Before running::: --------------:: - If your windows language is not in the language ID set (see above in the "Parameters", 1.),:: you should have the correct value in the environment string STR2FIND.:: To do that, you should put a part of the answer DISKPART display when you:: try to modify a reassignable drive letter.:: To find this string, execute the following (without the text in () which are comments)::: DISKPART:: LIST VOLUME:: SELECT VOLUME x (select an n on-system drive):: ASSIGN LETTER d (the same as the current letter):: (DISPART display the message that you should take):: SELECT VOLUME y (select the system drive):: ASSIGN LETTER e (the same as the current letter of the system drive):: (DISPART display an error message telling you that you:: ( cannot reassign the letter for a system drive, boot:: ( drive or a drive qhere is the swap file):: EXIT:: You should take a part of the first message which is not in the second:: message, and stop the string on accentuated characters.:::: Notes::: -----:: When run, MapDrive.cmd scans all the drives (volumes) for files matching:: "\DRIVE.?". If the file "\DRIVE.d" is encountered on a volume, this volume:: is reassigned with the letter "d:".:: Do not forget that the system drive as well as the drive containing the page:: file (and others) could not be reassigned.:: You may also reassign CD/DVD letters by creating one or many files "\DVD.d":: and/or "\CDR.d" on the system drive.:: You may also disable drive letters by creating one or many files "\DRIVE-.d":: on the system drive.:::: This script works on FAT32 and NTFS file system. this is not the case for:: MOUNTVOL which accepts only NTFS. Furthermore, no reboot is required.:::: The drives which are already assigned to the "good" letter will not be removed:: nor reassigned.:::: IMPORTANT: I am not responsible for any damage caused directly or indirectly:: by this program. So, before using it, run this batch with TEST as second parameter.:: -------------------------------------------------------------------------------EDIT: If your Windows language is English, German, Dutch or French, you don't have to worry about all of that: just callMapDrive ENU, or MapDrive DEU, MapDrive NLD or MapDrive FRA.Current attachement version is 2008/08/04::: 2008/08/04 : Dutch language added (Thanks to Orcinus):: 2005/10/30 : Reassigning twice (to avoid bad assigning to a used letter):: 2005/10/28 : Try to keep the existing letters.:: Group deasignments and reassignments._____________________________________________Keywords: drive drives partition partitions letter letters volume volumes mapdrive drivemap diskpart change changing rename renaming modify modifyingMapDrive.cmd.txtMapDrive.cmd.txt Edited November 11, 2009 by mdes
titou2k Posted April 18, 2004 Posted April 18, 2004 Good job, i quickly read the script and i understand how it works. I will test it next time. But for non french version, there is a problemLine 99 you use --> FIND /C "La lettre sp"The string is in french so in other language version, the string won't be find.A+
mdes Posted April 19, 2004 Author Posted April 19, 2004 But for non french version, there is a problemLine 99 you use --> FIND /C "La lettre sp"The string is in french so in other language version, the string won't be find.You are right I added comment in the post and in the batch file to tell how to change this string.
yourtech Posted April 19, 2004 Posted April 19, 2004 Awesome!!!! Funny how i was only just looking into this yesterday heh.muchos gracias!!I'm sure alot of other ppl will be quite happy to find this one also. now honestly, is it reliable?
mdes Posted April 19, 2004 Author Posted April 19, 2004 (edited) now honestly, is it reliable? Yes it has been tested The only problem I encountered is that, sometimes (it depends of the installed Windows), the CD drive is not reassigned when there is a CD in the tray. I found why: the output file of DISKPART is UNICODE, so there is 2 characters at the file beginning. I will solve this problem in a few hours EDIT: Sould be solved now: This was not a UNICODE problem but LF instead of CRLF. Edited April 19, 2004 by mdes
mdes Posted April 19, 2004 Author Posted April 19, 2004 Got one in Anglais?? hehe Try as described above (DISKPART) and put the result as a post
yourtech Posted April 22, 2004 Posted April 22, 2004 I've tried running this on a Ghost 8 PC-dos boot disk (floppy) to boot to a lan mount of the Install/Windist dir,it no worky fo meI get this spew about "Out of environment space""Bad command or filename"can someone explain how to run this mapdrive.cmd on an unattended install(obviously prior to install so my D and E are in the right place)I'm trying to accomplish this on a dual boot (xp/2K) machine (2 C:'s (each hidden from each other), 2 D:'s, and 1 E:)
mdes Posted April 22, 2004 Author Posted April 22, 2004 Yes, MapDrive.cmd use a lot a environment space Here is a solution:In CONFIG.SYS, add the following lineshell=C:\cmd.com /P /E:nnnwhere n is the number of bytes you want to set aside for the environment. For DOS 6.22 nnn represents the number of bytes you want to set aside. So for a 2K environment take nnn=2048 (try with a larger value, e.g. 8192 or more)About ""Bad command or filename", I suppose this is a consequence of the out of environement space.For unattended, I am using the following:File command.txt[COMMANDS]RunOnceEx.cmd"File RunOnceEx.cmdSET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx...REG ADD %KEY%\800 /VE /D "Modifying Drives Letters" /fREG ADD %KEY%\800 /V 1 /D "%systemdrive%\Install\MapDrive.cmd" /f...
yourtech Posted April 22, 2004 Posted April 22, 2004 shell=C:\cmd.com /P /E:nnnThanks eh! saw that on one of my anicent config.sys's, was wondering what that was lolquestion: is that ram or cache and how far could you go with say:256K cache=?512K cache=?256Meg Ram=?1024Meg Ram=?File RunOnceEx.cmdDidn't know it could be run that late in the game eh. Awesome (but before anything else of course)
yourtech Posted April 22, 2004 Posted April 22, 2004 k not getting any environment errors,(although 8192 might be a little high; and it stopped NET.exe from from doing something, I still got in.)but still getting syntax erros and bad command or filename(repeated about 20-30 times)just tried running diskpart says it cannot be run under dosso i guess its the runonceex method ehquestion about that then,Won't I need it to run before the os even gets installed so that my folder redirections will work?http://groups.msn.com/MicrosoftWindowsXPRe...464671898804519http://www.microsoft.com/WindowsXP/expertz...2/honeycutt.aspor is the 12/13minute mark going to be ok for that?(runonceex launched from/in commandlines.txt) or is it going to have to be put someplace sooner?
yourtech Posted April 22, 2004 Posted April 22, 2004 doh! n/m just stuck it 2nd in the list. REG ADD %KEY%\001 /VE /D "Turning system restore off" /fREG ADD %KEY%\001 /V 1 /D "REGEDIT /S Z:\SCRIPTS\sysresoff.reg" /f REG ADD %KEY%\002 /VE /D "Modifying Drives Letters" /fREG ADD %KEY%\002 /V 1 /D "Z:\SCRIPTS\MapDrive.cmd" /f REG ADD %KEY%\003 /VE /D "Setting Personal & Settings Folders Redirects" /fREG ADD %KEY%\003 /V 1 /D "REGEDIT /S Z:\SCRIPTS\Redirect.inf" /fthat should do it eh but i'm still stuck on this tho http://www.msfn.org/board/index.php?act=ST...t=0#entry124886
mdes Posted April 22, 2004 Author Posted April 22, 2004 @yourtech: Could you NOT use "words" such as "doh", "n/m", "tho", "k";...: I cannot understand them
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now