|
Answer» My question is how can I change to the drive letter of my usb drive when I do not know the drive letter it is ASSIGNED to?
Here is an example... f: net USE Z: \\nts29\nofdata3\national /user:****** z: cd lenovo\t61\internal\win732 xcopy *.* d:\*.* f: %cd%tools\pe_tools\imagex.exe /apply d:\T61_w7sr.wim 1 c: PAUSE echo Press any key to continue %cd%tools\pe_tools\imagex.exe /apply d:\T61_w732.wim 1 d:
When booting off a windows PE boot usb drive, it defaults to open the x drive. I want to change to my usb drive (like f: in the example) without knowing the drive letter. Can I use the usb drive label? That will at least be consistent. Any other ideas are welcome.
Thanks, KeithLet me clarify this a bit... I realize I need to change to my usb drive to run this batch file, but I do not want to have to change the USB drive letter in this batch file everytime I run it. Say one time I boot off my Windows PE usb drive and it assignes my usb drive as e:. I do not want to have to edit this batch file and change the f: to e:. I want this batch file to select the usb drive automatically. Does this make sense? If I am not explaining this very well, sorry.
Like this...
usbdrive: net use z: \\nts29\nofdata3\national /user:****** z: cd lenovo\t61\internal\win732 xcopy *.* d:\*.* usbdrive: %cd%tools\pe_tools\imagex.exe /apply d:\T61_w7sr.wim 1 c: PAUSE echo Press any key to continue %cd%tools\pe_tools\imagex.exe /apply d:\T61_w732.wim 1 d:This may work, however if you have more than one removable drive on the system (not counting the USB drive, this will probably fail. You might try Windows Script.
Code: [Select]@echo off for /f "tokens=3" %%i in ('echo list volume ^| diskpart ^| find /i "removeable"') do ( echo Removable drive is %%i: )
Thank you very much for the reply. Keep in mind, there should be an OPTION of "EXTREME" newbie when joining this site.
I tried this...
net use z: \\nts29\nofdata3\national /user:KII\kvogler z: cd lenovo\t61\internal\win732 xcopy *.* d:\*.* @echo off for /f "tokens=3" %%i in ('echo list volume ^| diskpart ^| find /i "removeable"') do ( echo Removable drive is %%i: ) i: %cd%tools\pe_tools\imagex.exe /apply d:\T61_w7sr.wim 1 c: PAUSE echo Press any key to continue %cd%tools\pe_tools\imagex.exe /apply d:\T61_w732.wim 1 d:
It returns an error that says "The system cannot find the drive specified." and "The system cannot find the path specified."
I did do a diskpart /list volume to make sure that is the only "removable drive" available and it is...
volume 0 E dvd drive volume 1 C partition volume 2 D partition volume 3 F Removable
Am I typing the syntax incorrectly? If not, i'll try the scripting forums. Thanks againCode: [Select]net use z: \\nts29\nofdata3\national /user:KII\kvogler z: cd lenovo\t61\internal\win732 xcopy *.* d:\*.* @echo off for /f "tokens=3" %%i in ('echo list volume ^| diskpart ^| find /i "removeable"') do ( echo Removable drive is %%i: set usbdrive=%%i: ) i: %cd%tools\pe_tools\imagex.exe /apply d:\T61_w7sr.wim 1 c: PAUSE echo Press any key to continue %cd%tools\pe_tools\imagex.exe /apply d:\T61_w732.wim 1 d:
I added a variable (usbdrive) that based on your diskpart results should have a value of f: Use %usbdrive% wherever you need the f: value.
Also, these two statements:
%cd%tools\pe_tools\imagex.exe /apply d:\T61_w7sr.wim 1 c: %cd%tools\pe_tools\imagex.exe /apply d:\T61_w732.wim 1 d:
might be in error. The %cd% variable does not include the trailing back slash. If you need the back slash, you need to enter it yourself:
%cd%\tools\pe_tools\imagex.exe /apply d:\T61_w7sr.wim 1 c: %cd%\tools\pe_tools\imagex.exe /apply d:\T61_w732.wim 1 d:
Good luck. The best way to have any external drive keep it's designation as a drive letter is to give it a Volume Label and a drive letter that is outside of the parameters of any machine you use it on... For rexample if your last drive is E: or F: commonly than pick a letter way out of the range such as L: or M;.....you get the picture... With a Volume Label the drive will hold it's drive letter from machine to machine and won't care about getting swapped.
This Public Service announcement is brought to you by all the fine contributors here at CH Forums.
|