ner Posted November 22, 2008 Share Posted November 22, 2008 I am using the below ode to try and assign the cd letter to k:code:echo list volume > X:\ListCD.txtFOR /F "tokens=2,4" %%i IN ('diskpart /s X:\ListCD.txt') DO @IF /I %%j == CD_ROM SET CDROMVOL=%%iIF DEFINED CDROMVOL echo select volume %CDROMVOL% > X:\ChangeCD.txtIF DEFINED CDROMVOL echo assign letter=K: >> X:\ChangeCD.txtIF DEFINED CDROMVOL diskpart /s X:\ChangeCD.txtcall Menu.cmdthis works within Virtual PC but when i boot from the cd on system it assigned the USB hard drive to KPc has2 x harddrives assign c & d2 x CD's assigned as e & fand then USB as k? Link to comment Share on other sites More sharing options...
jaclaz Posted November 22, 2008 Share Posted November 22, 2008 Maybe the "k" letter is already "busy" (assigned to the USB HD) when you run the batch.Are we talking about Win PE 1.x (XP/2003 based) or 2.x (Vista based)? With version 1.x drive letters can be assigned through migrate.inf, cannot say for 2.x.jaclaz Link to comment Share on other sites More sharing options...
WreX Posted November 24, 2008 Share Posted November 24, 2008 That code assumes that there is only one CD drive. Launch diskpart, then issue the command "list volume" and see how many "CD_ROM" values are listed. That FOR loop will set the CDROMVOL variable to the volume number listed on the last line that contains "CD_ROM", so you may need to make some changes or try something altogether different to get your desired result. Link to comment Share on other sites More sharing options...
darksimoon Posted November 28, 2008 Share Posted November 28, 2008 I am using the below ode to try and assign the cd letter to k:code:echo list volume > X:\ListCD.txtFOR /F "tokens=2,4" %%i IN ('diskpart /s X:\ListCD.txt') DO @IF /I %%j == CD_ROM SET CDROMVOL=%%iIF DEFINED CDROMVOL echo select volume %CDROMVOL% > X:\ChangeCD.txtIF DEFINED CDROMVOL echo assign letter=K: >> X:\ChangeCD.txtIF DEFINED CDROMVOL diskpart /s X:\ChangeCD.txtcall Menu.cmdthis works within Virtual PC but when i boot from the cd on system it assigned the USB hard drive to KPc has2 x harddrives assign c & d2 x CD's assigned as e & fand then USB as k?i'm not good at such complicated scripts. i just adjust templates to my needs. so can we use above script for usb flash disk in order to determine UFD letter fixed (U: for instance) Link to comment Share on other sites More sharing options...
jaclaz Posted November 28, 2008 Share Posted November 28, 2008 i'm not good at such complicated scripts. i just adjust templates to my needs. so can we use above script for usb flash disk in order to determine UFD letter fixed (U: for instance)In other words, being:not good at such complicated scriptsyou propose to "adjust" a "reported-as-not-working-template"to my needsLet's see if we can solve the problem.@nerHINT:try running simply@ECHO OFFSETLOCAL ENABLEEXTENSIONSSETLOCAL ENABLEDELAYEDEXPANSIONREM ********************************REM ENTER BELOW DESIRED DRIVE LETTERSET CDROMLETTER=KREM ********************************IF EXIST ChangeCD.txt DEL ChangeCD.txtFOR /F "tokens=2,3,4" %%A IN ('ECHO List Volume ^| diskpart.exe ^| FIND "Volume" ^| FIND /v "Volume n."') DO (Set Busy=!Busy! %%BSET Type=%%CSET Type=!Type:~-3!IF !Type!.==ROM. SET CDROMVOL=!CDROMVOL! %%A&SET CDROMCOUPLE=!CDROMCOUPLE! %%A%%B)SET CDROMS=%CDROMVOL:~0,2%IF "%CDROMS%"=="%CDROMVOL%" (SET NEWCDLETTER=%CDROMLETTER%SET VOLUME=%CDROMCOUPLE:~1,1%SET LETTER=%CDROMCOUPLE:~2,1%GOTO :Change_letter):Choose_letterFOR %%A IN (%CDROMCOUPLE%) DO (SET COUPLE=%%ASET VOLUME=!COUPLE:~0,1!SET LETTER=!COUPLE:~1,1!IF "!LETTER!"=="%CDROMLETTER%" GOTO :SkippedECHO Volume !VOLUME! is a CD/DVD ROM mounted as letter !LETTER!:ECHO Please enter a new drive letter for Volume !VOLUME! [Press ENTER to leave current]ECHO Already BUSY drive letters are %BUSY%SET NEWCDLETTER=!LETTER!SET /P NEWCDLETTER=IF NOT "!NEWCDLETTER!"=="!LETTER!" CALL :Change_letter)GOTO :EOF:Change_letterFOR %%A IN (%BUSY%) DO (REM IF "%NEWCDLETTER%"=="%CDROMLETTER%" GOTO :SkippedIF "%NEWCDLETTER%"=="%%A" CLS&ECHO Letter %NEWCDLETTER%: is BUSY. &GOTO :Choose_letter)(ECHO SELECT VOLUME !VOLUME!ECHO ASSIGN LETTER=!NEWCDLETTER!:)>>ChangeCD.txt:SkippedECHO.ECHO Volume: %VOLUME%ECHO Current: %LETTER%: ECHO New: %NEWCDLETTER%:GOTO :EOFNO guarantees of it working properly, nor of it working at all, mind you. @darksimonThe whole problem is that diskpart has not a way (or at least we didn't find one) to determine whether a drive is a USB one (or maybe the Vista version has? )But you can "adapt" the above "template" for using the data in the "label" column to identify correctly a (USB) Volume with a given LABEL. Cannot say what happens if you change the actual drive letter from a batch which is running from that same drive. jaclaz Link to comment Share on other sites More sharing options...
darksimoon Posted November 28, 2008 Share Posted November 28, 2008 hello jaclaz really i'm glad to meet you for your help i think i solved the drive letter issue temporarly. as far as i see (if i dont misunderstand) winpe and windows xp has different approaches to assign drive letters. that is it doesnt matter which letter is assigned to system partition at vista environment. when windows is installed and login, xp will automaticly assign letter C to sytem partition and following up partitions with following letters. if so i my partinfo.txt as below and it worked =================select disk 1select partition 1assign letter=Uselect disk 0cleancreate partition primary size=10000activeassign letter=Pformat fs=ntfs label="SYSTEM" quickcreate partition primaryassign letter=Rformat fs=ntfs label="DATA" quickexit=================Now my new problem is setup created two folder and two files ($win_...BT$ ; $win_...LS$ ntdetect.com NTLDR) at system disk root. then nothing happend what might be missing ? my autorun1.cmd file is below.=================DISKPART /s partinfo.txtSET CDROM=%~d0%CDROM%\WXP86\i386\winnt32.exe /syspart:P: /tempdrive:P /unattend:"%CDROM%\WXP86\i386\winnt.sif" /makelocalsource================= Link to comment Share on other sites More sharing options...
jaclaz Posted November 28, 2008 Share Posted November 28, 2008 (edited) That's perfectly "normal". You used "/makelocalsource" switch.The switch should:1) copy locally files to $WIN_NT$.~BT and $WIN_NT$.~LS2) copy NTDETECT.COM and NTLDR (actually a copy of SETUPLDR.BIN renamed as NTLDR) to ROOT of Active PartitionThen "nothing happens", sure nothing will happen until you re-boot, this time from the hard disk. Do check if a migrate.inf file has been created in $WIN_NT$.~BT, though.jaclaz Edited November 28, 2008 by jaclaz Link to comment Share on other sites More sharing options...
darksimoon Posted November 29, 2008 Share Posted November 29, 2008 hello jaclaz i'm smiling but inside i wanna cry after the file are created on the HDD i checked the migrate.inf file inside the $WIN_NT$.~BT and $WIN_NT$.~LS folders. But there wasnt. but the worse is when i restart the virtual machine, the text phase begins but after some changing lines it says "setup is starting windows" and then it gives BSOD error numbered 0x000007B i am seraching a solution for BSOD error and then i will be able to go on... Link to comment Share on other sites More sharing options...
jaclaz Posted November 29, 2008 Share Posted November 29, 2008 hello jaclaz i'm smiling but inside i wanna cry after the file are created on the HDD i checked the migrate.inf file inside the $WIN_NT$.~BT and $WIN_NT$.~LS folders. But there wasnt. but the worse is when i restart the virtual machine, the text phase begins but after some changing lines it says "setup is starting windows" and then it gives BSOD error numbered 0x000007B i am seraching a solution for BSOD error and then i will be able to go on...0x000007B means you are missing appropriate MASS STORAGE DRIVERS (which VM are you using?)Did you use a "real" hard disk (which BUS it uses?) or an hard disk image (which format was it?).The idea was to ADD (if not present) a migrate.inf file, generated by mkmigrateinf.cmd:http://www.911cd.net/forums//index.php?showtopic=19663to pre-assign the letter, or , if present to MODIFY it to the same effect.jaclaz Link to comment Share on other sites More sharing options...
darksimoon Posted November 29, 2008 Share Posted November 29, 2008 (edited) hi jaclaz you wont believe but i think i solved the letter assignment issue here'a what i did:i added install.cmd at the usb root. below is my install.cmd==================================SET CDROM=%~d0%CDROM%\WXP86\i386\winnt32.exe /syspart:C: /tempdrive:C /unattend:"%CDROM%\WXP86\i386\winnt.sif" /makelocalsource==================================and then i unmounted the winpe.wim image and added the partinfo.txt, start.cmd files under the .\mount folder. below is my partinfo.txt and start.cmd files=======partinfo.txt===============select disk 1select partition 1assign letter=Uselect disk 0cleancreate partition primary size=5000activeassign letter=Cformat fs=ntfs label="SYSTEM" quickcreate partition primaryassign letter=Dformat fs=ntfs label="DATA" quickexit==========start.cmd============@echo off & color 5b & title wellcome to my special USB Flash Disk :startclsset /p userinp=Press (1) for Install or (2) for Quit:set userinp=%userinp:~0,1%if "%userinp%"=="1" goto Installif "%userinp%"=="2" goto Quit:InstallDISKPART /s partinfo.txtU:\install.cmdgoto end:Quitexitgoto end:end pause>nul======================lastly add "\start.cmd" lines to startnet.cmd file which resides under mount\windows\system32. then i mounted the image file (winpe.wim) and added it under the usbroot/sources folder by renaming as boot.wim. when boot from usb, a windows occurs and asks if i want to install or not. in order to install, i press 1 and enter. then it applies the partinfo.txt as i want and assigns the letter C to HDD active partition. because i do all these commans from X:\. then it calls the install.cmd file and windows installation begins with the correct partition letters C:\systemD:\dataU:\winpe UDFE:\DVD-ROMi feel good... (somehow sometimes it gives me error saying script file couldnt read blah blah... but when get this error i go to x:\ and call start.cmd from there. i think it's not important error.)but the same BSOD continues i'm using vmware6 as virtual machine and winpe 2.0 as image file. once i added scsi drivers from a floppy image on the virtual machine but the result is same. i havent tried it on a real machine. but i believe it will be allright. i still continue to work. and of course by your help meanwhile i thank you again for your effort to help me Edited November 29, 2008 by darksimoon Link to comment Share on other sites More sharing options...
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