如何从脚本中检测已启动 USB 驱动器的驱动器盘符?
我从可启动 UFD 启动 WinPE 2,并且需要检测驱动器号以便告诉 ImageX 在哪里可以找到 WIM。 但是,根据我要成像的机器,安装的驱动器也不同。
我需要一种方法来一致地将 UFD 安装在 P: 或其他位置。 有没有办法检测启动计算机的驱动器号,或者有其他方法将 WIM 文件的位置传递给可从 startnet.cmd 访问的变量?
TechNet 上的其他人也遇到了同样的问题。
I'm launching WinPE 2 from a bootable UFD, and I need to detect the drive letter in order to tell ImageX where to find the WIM. However, depending on the machine I'm imaging, there are different mounted drives.
I need a way to consistently mount the UFD at, say, P: or something. Is there a way to detect the letter of the drive from which the machine was booted, or another way to pass the location of my WIM file to a variable accessible from startnet.cmd?
Here's someone else with the same issue over at TechNet.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
此 VBScript 将为每个可移动驱动器显示一条消息(字母:描述),可以轻松修改以搜索特定驱动器并返回字母。
不知道这是否有帮助。
This VBScript will show a message for each removable drive (letter:description), could be easily modified to search for a particular drive and return the letter.
Don't know if that helps at all.
与此处提到的其他解决方案相比,这是一个不太通用的解决方案,但似乎有一种特定的方法可以确定“RAM 驱动器启动”Windows PE 操作系统从哪个底层卷启动。 来自 Windows 自动安装工具包:
(相关注册表值位于 HKLM\SYSTEM\CurrentControlSet\Control 下。)
It's a less generic solution than the others mentioned here, but there appears to be a specific way to determine which underlying volume a "RAM-drive-booted" Windows PE OS was booted from. From the documentation on Windows PE in the Windows Automated Installation Kit:
(The registry value in question sits under HKLM\SYSTEM\CurrentControlSet\Control.)
这是一个非最佳解决方案。 在这种情况下,UFD 必须有一个特定的名称,该名称将传递给脚本,该脚本将搜索每个可能的驱动器号以查找匹配项。 依赖具有相同名称的闪存驱动器可能不切实际。
还是希望有人能给出更好的答案!
Here's a non-optimal solution. In this case, the UFD has to have a specific name, which is passed to the script which searches every possible drive letter for a match. It's probably not practical to rely on the flash drives all having the same name.
Still hoping someone pops by with a better answer!
为了更详细地阐述鲁本的答案,这是我的批处理文件:
To elaborate reuben's answer in more detail, here is my batch file: