를 어떻게 감지하의 드라이브 문자를 부팅되는 USB 드라이브에서 스크립트를 사용해야 할까요?
-
05-09-2019 - |
문제
내가 시작 WinPE2 부팅 UFD,그리고 나는 검출할 필요가에서 드라이브 문자를 알리기 위해 ImageX 곳을 찾 WIM.그러나 기계에 따라 나는 이미징,다른 장착된 드라이브입니다.
내가 필요로하는 방법을 지속적으로 마운트 UFD 에서,말씀,P:다.이 있는지 확인하는 방법을 문의 드라이브에서는 기계 부팅하거나,다른 방법을 통과하는 위치의 내 WIM 파일의 변수에서 액세스할 수 있 startnet.cmd?
여기에는 다른 사람과 동일한 문제에 관해서.
해결책
이 VBScript 이 메시지를 표시한 각각의 이동식 드라이브(문자:묘사),수은 쉽게 수정하여 검색에 대한 특정 드라이브 및 반품이다.
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colDisks = objWMIService.ExecQuery("Select * from Win32_LogicalDisk where MediaType = 11")
For Each objDisk in colDisks
Wscript.Echo objDisk.DeviceID & objDisk.Description
Next
알지 못하는 경우에서 가능합니다.
다른 팁
그것은 적은 일반적인 솔루션보다는 다른 사람을 언급하지만,여기 있는 특별한 방법을 결정하는 기본 볼륨"램 드라이브 부팅되면"윈도우 PE OS 부팅되었습니다.에서 documentation Windows PE 에 Windows 고급 설치 키트:
부팅하지 않는 경우 윈도우 배포 서비스,가장 좋은 방법 결정하는 Windows PE 에서 부팅 을 먼저 확인 PEBootRamdiskSourceDrive 가 레지스트리 키를 누릅니다.는 경우 그것은 존재하지 않는 드라이브를 검색 의 올바른 PEBootType 보 어떤 종류 태그의 파일을 식별하는 부팅이다.
(레지스트리 값을 질문은 아래에 앉아있\SOFTWARE\\SYSTEM\CurrentControlSet\Control.)
여기에는 비 최적의 솔루션을 제공합니다.이 경우,UFD 는 특정 이름이 전달되는 스크립트를 검색이 가능한 모든 드라이브 문자에 대한 일치합니다.그것은 아마 실제적인에 의존하는 플래시 드라이브를 모두 동일한 이름입니다.
여전히 기대는 사람 팝업에 의해 더 나은 대답입니다!
setlocal
:: Initial variables
set TMPFILE=%~dp0getdrive.tmp
set driveletters=abcdefghijklmnopqrstuvwxyz
set MatchLabel_res=
for /L %%g in (2,1,25) do call :MatchLabel %%g %*
if not "%MatchLabel_res%"=="" echo %MatchLabel_res%
goto :END
:: Function to match a label with a drive letter.
::
:: The first parameter is an integer from 1..26 that needs to be
:: converted in a letter. It is easier looping on a number
:: than looping on letters.
::
:: The second parameter is the volume name passed-on to the script
:MatchLabel
:: result already found, just do nothing
:: (necessary because there is no break for for loops)
if not "%MatchLabel_res%"=="" goto :eof
:: get the proper drive letter
call set dl=%%driveletters:~%1,1%%
:: strip-off the " in the volume name to be able to add them again further
set volname=%2
set volname=%volname:"=%
:: get the volume information on that disk
vol %dl%: > "%TMPFILE%" 2>&1
:: Drive/Volume does not exist, just quit
if not "%ERRORLEVEL%"=="0" goto :eof
set found=0
for /F "usebackq tokens=3 delims=:" %%g in (`find /C /I "%volname%" "%TMPFILE%"`) do set found=%%g
:: trick to stip any whitespaces
set /A found=%found% + 0
if not "%found%"=="0" set MatchLabel_res=%dl%:
goto :eof
:END
if exist "%TMPFILE%" del "%TMPFILE%"
endlocal