我怎么可以检测到的驱动的信启动一个u盘,从剧本吗?
-
05-09-2019 - |
题
我发射2创从可启动一个u盘,并且我需要检测的驱动的信以告诉ImageX在哪里可以找到WIM。然而,根据机我像,有不同的安装盘。
我需要一种可持续山u盘,也就是说,P:或者什么的。有没有方法检测的信的驱动的机器启动,或另一种方式传递的位置我WIM文件的一个变量可从startnet.cmd?
这里的其他人有同样的问题在TechNet.
解决方案
此的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
不知道有没有什么帮助的。
其他提示
这比这里提到的其它较不通用的解决方案,但似乎存在,以确定哪些潜在体积“RAM驱动器引导的”视窗PE OS从启动以特定的方式。从 Windows高级安装工具包:
如果你不启动Windows 部署服务,以最好的方式 确定Windows PE启动,从 是为第一次检查 PEBootRamdiskSourceDrive注册表项。 如果它不存在,扫描的驱动器 正确PEBootType和寻找 某种标记文件的标识 引导驱动器。
(有问题的注册表值位于下HKLM \系统\ 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
不隶属于 StackOverflow