我如何可以检测从脚本启动的USB驱动器的驱动器号? [英] How can I detect the drive letter of a booted USB drive from script?

查看:239
本文介绍了我如何可以检测从脚本启动的USB驱动器的驱动器号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是从一个可启动的UFD启动WinPE的2,我需要检测才能告诉ImageX的在哪里可以找到WIM盘符。但是,根据机器我成像上,有不同的安装的驱动器。

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.

我需要一种方法来始终如一地安装在UFD,比方说,P:什么的。有没有一种方法来检测从该机器启动的驱动器,或另一种方式的信给我WIM文件的位置,距离的Startnet.cmd传递给一个变量访问?

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?

下面是别人与TechNet上的同一个问​​题了。

Here's someone else with the same issue over at TechNet.

<一个href=\"http://social.technet.microsoft.com/Forums/en-US/itprovistadeployment/thread/3e8bb8db-a1c6-40be-b4b0-58093f4833be?prof=required#\" rel=\"nofollow\">http://social.technet.microsoft.com/Forums/en-US/itprovistadeployment/thread/3e8bb8db-a1c6-40be-b4b0-58093f4833be?prof=required#

推荐答案

这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.

 
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

不知道有没有什么帮助的。

Don't know if that helps at all.

这篇关于我如何可以检测从脚本启动的USB驱动器的驱动器号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆