![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-25 23:14 |
47,812 topics / 349,910 posts / today 0 new / 48,264 members |
| DOS批处理 & 脚本技术(批处理室) » [Partially closed]Is there a USB drive letter recognition program like findcd called findusb? |
| Printable Version 6,964 / 26 |
| Floor1 hxj | Posted 2006-04-04 15:57 |
| 中级用户 Posts 66 Credits 377 | |
|
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 ] |
|
| Floor2 3742668 | Posted 2006-04-04 17:30 |
| 荣誉版主 Posts 718 Credits 2,013 | |
|
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. |
|
| Floor3 Climbing | Posted 2006-04-04 22:24 |
| 铂金会员 Posts 2,753 Credits 6,962 From 河北保定 | |
|
The person upstairs, by the way, I would like to ask, how to use wmic to execute a command on another machine?
|
|
| Floor4 3742668 | Posted 2006-04-04 23:22 |
| 荣誉版主 Posts 718 Credits 2,013 | |
|
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. |
|
| Floor5 hxj | Posted 2006-04-05 01:50 |
| 中级用户 Posts 66 Credits 377 | |
|
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! |
|
| Floor6 hxj | Posted 2006-04-05 04:11 |
| 中级用户 Posts 66 Credits 377 | |
|
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? |
|
| Floor7 3742668 | Posted 2006-04-05 10:00 |
| 荣誉版主 Posts 718 Credits 2,013 | |
|
Wrap it with for..
Let's see if it works, not tested. |
|
| Floor8 hxj | Posted 2006-04-05 10:37 |
| 中级用户 Posts 66 Credits 377 | |
Originally posted by 3742668 at 2006-4-5 10:00 AM: 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! |
|
| Floor9 3742668 | Posted 2006-04-05 10:49 |
| 荣誉版主 Posts 718 Credits 2,013 | |
|
What about this sentence?
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. |
|
| Floor10 hxj | Posted 2006-04-05 11:00 |
| 中级用户 Posts 66 Credits 377 | |
|
: :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! |
|
| Floor11 hxj | Posted 2006-04-05 11:19 |
| 中级用户 Posts 66 Credits 377 | |
|
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! |
|
| Floor12 hxj | Posted 2006-04-15 04:47 |
| 中级用户 Posts 66 Credits 377 | |
|
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 ] |
|
| Floor13 buddiyar | Posted 2006-07-21 21:33 |
| 初级用户 Posts 75 Credits 160 | |
|
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 |
|
| Floor14 willsort | Posted 2006-07-21 21:56 |
| 元老会员 Posts 1,512 Credits 4,432 | |
|
Re buddiyar:
wmic is obviously not an internal command, but it is a default installation component of WinXP/03. When you run wmic for the first time, it will prompt you to install to complete the configuration, and you can directly use it in cmd or batch files later. Please refer to: WMI Command Line http://www.cn-dos.net/forum/viewthread.php?tid=19738#pid115977 |
|
| Floor15 gmy | Posted 2006-09-11 21:06 |
| 版主 Posts 392 Credits 1,113 | |
|
The character judgment of "removable disk" does not take into account the situation of USB-HDD (local hard disk).
|
|
| 1 2 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |