![]() |
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-11 07:44 |
47,811 topics / 349,897 posts / today 0 new / 48,256 members |
| DOS批处理 & 脚本技术(批处理室) » [Closed]Is there a batch script to delete a USB drive |
| Printable Version 14,037 / 66 |
| Floor1 eech | Posted 2006-12-14 08:52 |
| 高级用户 Posts 346 Credits 906 | |
|
Plays the role of popping up the window in the picture
[ Last edited by HAT on 2008-10-22 at 11:44 ] |
|
| Floor2 0401 | Posted 2006-12-14 10:45 |
| 中级用户 Posts 88 Credits 435 | |
|
I'll send you an attachment for you to study by yourself.
Attachments ReScanUsb.rar (14.85 KiB) |
|
| Floor3 zh159 | Posted 2006-12-14 13:16 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
|
Just found it while researching ^_^
|
|
| Floor4 zh159 | Posted 2006-12-14 13:32 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
Originally posted by lxmxn at 2006-12-14 00:30: You replied to the wrong post upstairs? Hehe^_^ |
|
| Floor5 lxmxn | Posted 2006-12-14 13:42 |
| 版主 Posts 4,938 Credits 11,386 | |
|
Hmm. I replied to the wrong one. I'll delete it immediately. |
|
| Floor6 ccwan | Posted 2006-12-14 20:59 |
| 金牌会员 Posts 1,160 Credits 2,725 From 河北廊坊 | |
|
It seems to be immediately recognized by the system again ^_^
|
|
| Floor7 dbc6013 | Posted 2006-12-14 21:08 |
| 初级用户 Posts 16 Credits 55 | |
| Floor8 zh159 | Posted 2006-12-14 21:29 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
|
Correct usage:
for /f %%i in ('devcon findall usb* ^|find /i "usb mass storage"') do devcon remove "@%%i" After removing the USB flash drive, unplug it, then execute devcon rescan Or you don't need to execute devcon rescan, the next time you insert it, it will automatically rescan the USB flash drive |
|
| Floor9 ccwan | Posted 2006-12-14 21:36 |
| 金牌会员 Posts 1,160 Credits 2,725 From 河北廊坊 | |
|
It's immediate recognition!
|
|
| Floor10 zh159 | Posted 2006-12-14 22:38 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
Originally posted by ccwan at 2006-12-14 08:36: I tried several times last night. The correct method: Execute "for /f %%i in ('devcon findall usb* ^|find /i "usb mass storage"') do devcon remove "@%%i" to remove the USB flash drive, then unplug the USB flash drive, and then execute "devcon rescan" to scan new hardware. If executed together, the USB flash drive is not unplugged in time and is scanned out; of course, you can also not execute "devcon rescan" |
|
| Floor11 eech | Posted 2006-12-15 07:13 |
| 高级用户 Posts 346 Credits 906 | |
|
for /f %%i in ('devcon findall usb* ^|find /i "usb mass storage"') do devcon remove "@%%i"
ZH159. I executed the command you said. The result is as shown in the following picture: http://photo.bababian.com/20061214/CCDD60BD673FC5FF4525D5B71E7CD1F9.jpg |
|
| Floor12 lxmxn | Posted 2006-12-15 07:24 |
| 版主 Posts 4,938 Credits 11,386 | |
|
In the command line, when executing the for statement, %%i should be changed to %i, which is different from %%i in batch scripts.
|
|
| Floor13 eech | Posted 2006-12-15 10:10 |
| 高级用户 Posts 346 Credits 906 | |
|
Which senior can just write a command for me. I'll modify this. Can't remove that. Just can't.
|
|
| Floor14 eech | Posted 2006-12-15 10:17 |
| 高级用户 Posts 346 Credits 906 | |
|
ZH159 big shot
"You just need to remove that line where devcon rescan is added in your bat. Because this is for rescanning. ReScanUsb~ You just need to delete that line and there's no need for rescan. Also, you can just reply directly instead of sending me a private message." Do you mean to remove the letters devcon rescan? Keep the rest unchanged. I tried but it still doesn't work. Is there any problem with spaces? Can you send it again? Please help, kind person |
|
| Floor15 0401 | Posted 2006-12-15 10:37 |
| 中级用户 Posts 88 Credits 435 | |
|
......
It should be no problem. You just want to delete the device, so in that P processing file, as long as there is this line: for /f %%i in ('devcon findall usb* ^|find /i "usb mass storage"') do devcon remove "@%%i" devcon rescan is to rescan the device, so you don't need to add it. I think I explained it very detailedly~ |
|
| 1 2 3 4 … 5 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |