2
I have a "WINPE" volume and I am trying to get a batch script that will assign it drive letter "Z:"
Someone gave me the script below but it does not work
for /f %%D in ('wmic volume get DriveLetter^, Label ^| find "WINPE"') do set myDrive=%%D
@echo off
echo ===============================================================================
echo. Mobile Repairs Install
echo ===============================================================================
echo. 1 - Install Windows 7 Home Premium
echo. 2 - Install Windows 7 Prefessional
echo. 3 - Install Windows 8.1
echo ===============================================================================
echo. Press Zero '0' to Quit
echo ===============================================================================
echo off
:begin
echo Select a task:
echo =============
set /p op=Type option:
if "%op%"=="1" goto op1
if "%op%"=="2" goto op2
if "%op%"=="3" goto op3
if "%op%"=="0" goto op0
echo Please Pick an option:
goto begin
:op1
%myDrive%
diskpart /s diskpartrans.txt
imagex /apply install7Pre.wim 1 c:
c:\windows\system32\bcdboot c:\windows
c:\Windows\system32\shutdown /r /t 0
goto end
:op2
%myDrive%
diskpart /s diskpartrans.txt
imagex /apply install7Pro.wim 1 c:
c:\windows\system32\bcdboot c:\windows
c:\Windows\system32\shutdown /r /t 0
goto end
:op3
%myDrive%
diskpart /s diskpartrans.txt
imagex /apply install8.wim 1 c:
c:\windows\system32\bcdboot c:\windows
c:\Windows\system32\shutdown /r /t 0
goto end
:op0
exit
:end
Debugging your batch files – DavidPostill – 2015-07-24T20:19:46.797
That didn't help me. I am sorry – Emery Williams – 2015-07-25T14:43:37.837
"Does not work" is not very useful - are there any messages? Are you running the script as an admistrator? What is your operating system? – DavidPostill – 2015-07-25T16:27:27.863
I am trying to run a script from within a bootable WINPE drive I mounted the boot.wim and made a bat with for /f %%D in ('wmic volume get DriveLetter^, Label ^| find "WINPE"') do set myDrive=%%D referring it to use %myDrive%. I have used the debugging and it found no errors as it works on cmd just not under WINPE cmd – Emery Williams – 2015-07-25T17:50:16.867
I edited the original post with my exact script I just made – Emery Williams – 2015-07-25T17:55:51.017
So you have a different script. You still just say "Does not work". What is it supposed to do that it doesn't. I've no idea what "Does not work" means. You have to tell us if you want help. – DavidPostill – 2015-07-25T17:58:11.203
My apologies I am new batch files and the board. I am trying to get the script to run under WINPE – Emery Williams – 2015-07-25T17:59:31.083
I know that. What doesn't work?. Which bit of the script does the Wrong thing? – DavidPostill – 2015-07-25T18:01:01.037
Whenever I run the script in WINPE it doesn't change the drive from X: to %myDrive% but if it run the script under Windows 7 CMD it does – Emery Williams – 2015-07-25T18:01:30.533
I am not good at explaining via typing anyway to help by phone? – Emery Williams – 2015-07-25T18:02:03.980
Whenever I run the script in WINPE it doesn't change the dir not drive from X: to %myDrive% but if it run the script under Windows 7 CMD it does – Emery Williams – 2015-07-25T18:02:46.430
What drive are you on when you run the script? – DavidPostill – 2015-07-25T18:03:26.877
Try using
cd /d %myDrive%
instead of%myDrive%
– DavidPostill – 2015-07-25T18:05:04.347Add
echo %myDrive%
as the second line of the script. What does it output? – DavidPostill – 2015-07-25T18:15:01.513I just tried it with your suggestion and I got The Filename, directory name, or volume label syntax is incorrect. – Emery Williams – 2015-07-25T18:19:58.997
Please run
wmic volume get DriveLetter, Label
from a command line and [edit] the question to include the output from this as well as the output fromecho %myDrive%
in the batch file. – DavidPostill – 2015-07-25T18:32:56.703When I put echo %myDrive% as the second line it just does
ECHO is on – Emery Williams – 2015-07-25T18:38:11.147
So the
for /f
isnt working. Please runwmic volume get DriveLetter, Label
from a command line and edit the question to include the output from this – DavidPostill – 2015-07-25T18:39:13.750