|
hxj
中级用户
  
积分 377
发帖 66
注册 2005-4-4
状态 离线
|
『楼 主』:
[部分已结]有否类似 findcd 的 U盘盘符识别程序 findusb ?
使用 LLM 解释/回答一下
有否类似 findcd 的 U盘盘符识别程序 findusb ?
为了在批处理中能搜索 U盘盘符,有否像 光盘盘符识别程序 findcd.exe这样的U盘盘符识别程序 findusb.exe ?
如没有现成的程序,那位高手能编写具有这一功能的批处理也行 !
Last edited by hxj on 2006-4-15 at 04:49 ]
Is there a USB drive letter identification program like findusb similar to findcd?
In order to search for USB drive letters in batch processing, is there a USB drive letter identification program like findcd.exe for optical drives, namely findusb.exe?
If there is no ready-made program, is there any expert who can write a batch processing with this function!
Last edited by hxj on 2006-4-15 at 04:49 ]
|
|
2006-4-4 15:57 |
|
|
3742668
荣誉版主
      
积分 2013
发帖 718
注册 2006-2-18
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
@echo off
echo 盘符 可用空间
wmic logicaldisk where Description="可移动磁盘" get DeviceID,FreeSpace | find /v "DeviceID"
wmic logicaldisk where DriveType="2" get DeviceID,FreeSpace | find /v "DeviceID"
pause>nul
看看是不是类似的效果?如果把"可移动磁盘"改为"CD-ROM 磁盘"则可以返回当前的光驱盘符。
其他事项见我的签名。
@echo off
echo Drive letter Available space
wmic logicaldisk where Description="Removable disk" get DeviceID,FreeSpace | find /v "DeviceID"
wmic logicaldisk where DriveType="2" get DeviceID,FreeSpace | find /v "DeviceID"
pause>nul
See if it's a similar effect? If you change "可移动磁盘" to "CD-ROM disk", it can return the current optical drive letter.
Other matters are in my signature.
|
|
2006-4-4 17:30 |
|
|
Climbing
铂金会员
       网络独行侠
积分 6962
发帖 2753
注册 2003-4-16 来自 河北保定
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
楼上的,顺便请教一下,如何用wmic在另一台机器上执行一条命令?
The person upstairs, by the way, I would like to ask, how to use wmic to execute a command on another machine?
|

偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
|
|
2006-4-4 22:24 |
|
|
3742668
荣誉版主
      
积分 2013
发帖 718
注册 2006-2-18
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
wmic /node:对方IP /user:username /password:yourpassword
在SP2环境中测试能连接上,但是似乎权限不够,亦或是对方未开启RPC。也许是用的空密码登陆的缘故吧,没条件,也懒得测试找原因了。
wmic /node:target IP /user:username /password:yourpassword
Tested in SP2 environment can connect, but it seems that the permissions are insufficient, or the other party has not enabled RPC. Maybe it is because of logging in with an empty password. There is no condition, and I am too lazy to test and find the reason.
|
|
2006-4-4 23:22 |
|
|
hxj
中级用户
  
积分 377
发帖 66
注册 2005-4-4
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
感谢3742668:
你写的批处理能达到目的!
你干脆把它编成一个应用程序findusb.exe ,应当还是很有实用价值的!
Thanks to 3742668:
The batch script you wrote achieves the goal!
You might as well compile it into an application findusb.exe, which should still be quite useful!
|
|
2006-4-5 01:50 |
|
|
hxj
中级用户
  
积分 377
发帖 66
注册 2005-4-4
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
再向3742668求教:
我把“FreeSpace”省去,只显示了U盘的盘符 “DeviceID”,但怎样才能把 显示的 “DeviceID”转变成批处理中能用的环境变量?
Then ask 3742668 again:
I omitted "FreeSpace" and only displayed the drive letter "DeviceID" of the USB flash drive, but how can I convert the displayed "DeviceID" into an environment variable that can be used in batch processing?
|
|
2006-4-5 04:11 |
|
|
3742668
荣誉版主
      
积分 2013
发帖 718
注册 2006-2-18
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
用for包起来吧。。
for /f %%i in ('"wmic logicaldisk where DriveType="2" get DeviceID |find /v "DeviceID""') do set mydrv=%%i
看看中不中,未经测试。
Wrap it with for..
for /f %%i in ('"wmic logicaldisk where DriveType="2" get DeviceID |find /v "DeviceID""') do set mydrv=%%i
Let's see if it works, not tested.
|
|
2006-4-5 10:00 |
|
|
hxj
中级用户
  
积分 377
发帖 66
注册 2005-4-4
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
Originally posted by 3742668 at 2006-4-5 10:00 AM:
用for包起来吧。。
for /f %%i in ('"wmic logicaldisk where DriveType="2" get DeviceID |find /v "DeviceID""') do set mydrv=%%i
看看中不中..
测试了,结果盘符不对,将我要解到U盘(I:)的文件解到当前盘(G:)去了。
之前,我自己胡编了一个到是能行,但总觉得不好,请你指教
usb.bat :
@echo off
path %SystemRoot%\system32\wbem;%SystemRoot%\system32\
wmic logicaldisk where Description="可移动磁盘" get DeviceID | find /v "DeviceID">a.txt
for /F "tokens=1" %%I in (a.txt) DO set USB=%%I
del a.txt
dosimg KV.img %USB%\ /s>nul
exit
但上面的批处理单独使用可以,用我的主批处理用call 调用就出错,不知为什么
最后用 start /wait /min usb.bat 到是成功了。我是DOS菜鸟,这样的语句是瞎凑的,我自己也搞不懂!
Originally posted by 3742668 at 2006-4-5 10:00 AM:
Wrap it with for..
for /f %%i in ('"wmic logicaldisk where DriveType="2" get DeviceID |find /v "DeviceID""') do set mydrv=%%i
See if it works ..
Tested, the result drive letter is incorrect, it extracted the file to the current drive (G:) instead of the USB drive (I:) I wanted to extract to.
Previously, I made one up myself that worked, but I always felt it wasn't good, please give me some advice
usb.bat:
@echo off
path %SystemRoot%\system32\wbem;%SystemRoot%\system32\
wmic logicaldisk where Description="Removable Disk" get DeviceID | find /v "DeviceID">a.txt
for /F "tokens=1" %%I in (a.txt) DO set USB=%%I
del a.txt
dosimg KV.img %USB%\ /s>nul
exit
But the above batch file works alone, but when called with call from my main batch file, it has an error, I don't know why
Finally, using start /wait /min usb.bat worked. I'm a DOS noob, these statements are made up randomly, I don't even understand them myself!
|
|
2006-4-5 10:37 |
|
|
3742668
荣誉版主
      
积分 2013
发帖 718
注册 2006-2-18
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
那这句呢?
for /f %%i in ('"wmic logicaldisk where Description="可移动磁盘" get DeviceID |find /v "DeviceID""') do set mydrv=%%i
也许你的U盘的类型不是2吧,我的光盘类型为3,U盘类型为2,现在不在手边,所以无法测试。你可以把前面的那句的DriveType="2"分别改成1,2,3,4,5等等测试了看看。
你的那个批处理可以把主批处理也贴上来,顺便说明一下环境包括目录。
What about this sentence?
for /f %%i in ('"wmic logicaldisk where Description="Removable Disk" get DeviceID |find /v "DeviceID""') do set mydrv=%%i
Maybe the type of your USB flash drive is not 2. My CD-ROM type is 3 and the USB flash drive type is 2. I'm not at hand now, so I can't test. You can change the DriveType="2" in the previous sentence to 1, 2, 3, 4, 5, etc. for testing.
You can also post the main batch file, and by the way, explain the environment including the directory.
|
|
2006-4-5 10:49 |
|
|
hxj
中级用户
  
积分 377
发帖 66
注册 2005-4-4
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
:3制作江民DOS杀毒闪盘
REM 制作江民 DOS 杀毒闪盘
path %Programfiles%\winrar
start /wait /min winrar e -p88888888 KV.pak kv.iso dosimg.exe -o+
start /wait /min winrar e kv.iso ezboot\kv.img -o+
cls
echo.
echo.
echo.
echo.
echo Now laoding databank into U disk, please wait......
start /wait /min usb.bat
del/q a.txt
del/q kv.i*
del/q d*.exe
GOTO BACKTOMENU
WinXP系统,当前目录 g:\dosav\kv\
你的比较简洁,我继续试!
: :3Make Jiangmin DOS Anti-virus Flash Drive
REM Make Jiangmin DOS Anti-virus Flash Drive
path %Programfiles%\winrar
start /wait /min winrar e -p88888888 KV.pak kv.iso dosimg.exe -o+
start /wait /min winrar e kv.iso ezboot\kv.img -o+
cls
echo.
echo.
echo.
echo.
echo Now laoding databank into U disk, please wait......
start /wait /min usb.bat
del/q a.txt
del/q kv.i*
del/q d*.exe
GOTO BACKTOMENU
Windows XP system, current directory g:\dosav\kv\
Your version is relatively concise, I will continue to try!
|
|
2006-4-5 11:00 |
|
|
hxj
中级用户
  
积分 377
发帖 66
注册 2005-4-4
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
好了!用你第一个批处理,PATH中加入%SystemRoot%\system32\;%SystemRoot%\system32\wbem就成功了!
非常感谢你这位高手的指教,受益匪浅!!
Okay! Using your first batch file, adding %SystemRoot%\system32\;%SystemRoot%\system32\wbem to the PATH was successful!
Thank you very much, expert, for your guidance, it has been very beneficial!
|
|
2006-4-5 11:19 |
|
|
hxj
中级用户
  
积分 377
发帖 66
注册 2005-4-4
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
此问题本来已解决,但现在碰到需要DOS7.1下识别U盘盘符问题,看来3742668的方法只能手在Windows下,在纯DOS下有否办法 ?
Last edited by hxj on 2006-4-15 at 04:48 ]
This problem was originally solved, but now there is a problem of identifying the USB flash drive drive letter under DOS 7.1. It seems that the method of 3742668 can only be done under Windows. Is there any way under pure DOS?
Last edited by hxj on 2006-4-15 at 04:48 ]
|
|
2006-4-15 04:47 |
|
|
buddiyar
初级用户
 
积分 160
发帖 75
注册 2006-6-28
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
wmic logicaldisk where Description="可移动磁盘" get DeviceID,FreeSpace | find /v "DeviceID"
这个wmic是内部命令么
怎么以前都没听说过啊
而且在我的机子上用wmic /? 也搜不到相关帮助信息哦
wmic logicaldisk where Description="Removable Disk" get DeviceID,FreeSpace | find /v "DeviceID"
Is this wmic an internal command?
Why have I never heard of it before?
And on my machine, using wmic /? doesn't find relevant help information either
|
|
2006-7-21 21:33 |
|
|
willsort
元老会员
         Batchinger
积分 4432
发帖 1512
注册 2002-10-18
状态 离线
|
|
2006-7-21 21:56 |
|
|
gmy
版主
        操作系统爱好者
积分 1113
发帖 392
注册 2002-11-11
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
“可移动磁盘”的字符判断没有考虑到USB-HDD(本地硬盘)的情况。
The character judgment of "removable disk" does not take into account the situation of USB-HDD (local hard disk).
|

DOS之家 http://doshome.com 站长 葛明阳 |
|
2006-9-11 21:06 |
|