|
220110
荣誉版主
      
积分 718
发帖 313
注册 2005-9-26
状态 离线
|
『楼 主』:
如何用批处理做到安全删除硬件?
使用 LLM 解释/回答一下
近日太多人打印简历了,朋友的机不停地插入U盘、MP3,又不停地从任务栏点击“安全删除硬件”……
想把批处理文件快捷方式放到快速启动栏单击就行,请问能否用批处理做到这事情?代码如何?
谢谢:>
Recently, too many people are printing resumes. My friend's computer keeps inserting USB drives, MP3s, and keeps clicking "Safely Remove Hardware" from the taskbar...
I want to put the batch file shortcut in the Quick Launch bar and just click it. Can it be done with a batch file? What's the code?
Thanks :>
|
|
2005-12-1 16:31 |
|
|
willsort
元老会员
         Batchinger
积分 4432
发帖 1512
注册 2002-10-18
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
Re 220110:
批处理的方案暂时没有想到,只是我的印象中,XP下直接插拔 U 盘等设备是不提示报警的,可能需要某些设置,未知。另外,如果确实需要安全删除,可以左键点击硬件图标,这样只需两次鼠标点击即可删除指定设备。
Re 220110:
The batch processing solution hasn't been thought of yet. Just in my memory, when plugging and unplugging USB drives and other devices directly under XP, there is no alarm prompt. It might need some settings, which is unknown. In addition, if you really need to safely remove, you can left - click the hardware icon, and then it only takes two mouse clicks to remove the specified device.
|

※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得! |
|
2005-12-1 16:54 |
|
|
JonePeng
金牌会员
      D◎$ Fαп
积分 4562
发帖 1883
注册 2004-1-19 来自 广东广州
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
Re 220110 and willsort:
借助第三方工具 Unlocker 和 unplug 就可以实现批处理快速拔下U盘。
以下内容引用 http://blog.dream4ever.org/venchia/
方法2
在windows这样的图形化界面中无法解决的问题。我们就有必要试一试在黑暗命令行状态下加以解决了。先下载unplug.rar这个软件, 解压缩后运行cmd命令打开命令行提示符窗口,然后使用dir命令进入 unplug.exe文件所在的目录,此处以停止H盘(假设H盘为闪存所在盘)为例。输入unplug H: 命令即可。当然,更高效的方法是做一个批处理来搞定。 (在脚本中cd 命令后的参数"d:\unplug"修改为unplug.exe所在的目录,"h"修改为闪存所占的盘符),将下面的脚本保存成usb.bat,在需要的时候双击就可以了,如果指定热键盘,就能一键卸载了!
usb.bat如下
@echo off
cd d:\unplug
unplug h:
如果unplug也不能搞定的话,那就轮到unlocker出场了
方法3
现在配合unlocker的/s命令行,先对要卸的设备盘符解锁,再unplug,基本上一次就卸了。
附上一个脚本
@echo off
REM IBM UDISK的特征串 3 USB Mass Storage Device\IC25N020 ATMR04-0 USB Device
echo #|unplug|findstr " USB Mass Storage Device\IC25N020">%temp%\tmpout.txt
for /f "usebackq delims= tokens=1,2,3" %%i in (%temp%\tmpout.txt) do (
"<路径>\Unlocker.exe" %%j /s
unplug %%i |findstr "OK."
if errorlevel 1 pause
)
该脚本里,如果还检测仍然卸不了的情况,若是出现,就运行pause提示一下,若是一闪而过,就可以拨设备了。
说明:
1, 替换成你的U盘的特征串,用unplug 来查看
2, 替换好unlocker的所在路径,建议把unlocker和unplug都放到搜索路径下。
3, 由于unplug不管unplug是否成功,都返回errrorlevel 为1 ,所以,改用findstr来判断是否unplug成功。
所用到的软件下载
unplug.rar
Unlocker.v1.66.GR.rar(1.66绿色版)
Unlocker.v1.7.3.rar
Re 220110 and willsort:
You can use third-party tools Unlocker and unplug to quickly unplug USB drives in batch processing.
The following content is quoted from http://blog.dream4ever.org/venchia/
Method 2
For problems that cannot be solved in a graphical interface like Windows, we need to try to solve them in the dark command line state. First, download the unplug.rar software, extract it, and then run the cmd command to open the command prompt window. Then use the dir command to enter the directory where the unplug.exe file is located. Here, taking stopping the H drive (assuming the H drive is the flash drive location) as an example, enter the command unplug H:. Of course, a more efficient method is to make a batch processing to get it done. (Modify the parameter "d:\unplug" after the cd command in the script to the directory where unplug.exe is located, and "h" to the drive letter occupied by the flash drive), save the following script as usb.bat, and double-click it when needed. If you specify a hot key, you can uninstall it with one click!
The usb.bat is as follows
@echo off
cd d:\unplug
unplug h:
If unplug can't get it done, then it's time for unlocker to come into play
Method 3
Now cooperate with the /s command line of unlocker, first unlock the device drive letter to be uninstalled, then unplug, basically it can be uninstalled at one time.
Attach a script
@echo off
REM Feature string of IBM UDISK 3 USB Mass Storage Device\IC25N020 ATMR04-0 USB Device
echo #|unplug|findstr " USB Mass Storage Device\IC25N020">%temp%\tmpout.txt
for /f "usebackq delims= tokens=1,2,3" %%i in (%temp%\tmpout.txt) do (
"<path>\Unlocker.exe" %%j /s
unplug %%i |findstr "OK."
if errorlevel 1 pause
)
In this script, if it is still detected that it cannot be uninstalled, if it occurs, run pause to prompt, and if it flashes by, you can pull out the device.
Instructions:
1, Replace with the feature string of your USB drive, use unplug to check
2, Replace the location of unlocker, it is recommended to put both unlocker and unplug in the search path.
3, Since unplug returns errorlevel as 1 regardless of whether unplug is successful or not, so use findstr to judge whether unplug is successful.
Software download used
unplug.rar
Unlocker.v1.66.GR.rar (1.66 green version)
Unlocker.v1.7.3.rar
|

----====≡≡≡≡ 我的至爱,永远是MSDOS!≡≡≡≡====----
|
|
2005-12-1 19:50 |
|
|
220110
荣誉版主
      
积分 718
发帖 313
注册 2005-9-26
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
首先谢谢 两位朋友!特别是小JONG,还把链接地址并上来了!谢谢!
我曾经尝试利用进程来结束掉相关进程,但并没发现有相关进程,只是选择“安全删除硬件”后才出现一个"rundll32.exe"。没用。
First of course, thank two friends! Especially little JONG, who also brought up the link address! Thanks!
I once tried to end related processes by using processes, but didn't find related processes. Only after selecting "Safely Remove Hardware" did a "rundll32.exe" appear. It didn't work.
|
|
2005-12-1 22:35 |
|
|
220110
荣誉版主
      
积分 718
发帖 313
注册 2005-9-26
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
我试了下小JONG 提供的第二方案,的确是一闪而过无提示,但通过硬件管理查看该硬件还是在启用的,所以还是不敢随便移除,毕竟是客户的东西,损坏了不好……
我们大家再努力! 
I tried the second plan provided by Xiao JONG, and indeed it flashed by without a prompt. But by checking through hardware management, this hardware is still enabled, so I still dare not remove it casually. After all, it's the client's stuff, and it's not good if it's damaged... Let's all work harder! :D
|
|
2005-12-1 22:40 |
|
|
无奈何
荣誉版主
      
积分 1338
发帖 356
注册 2005-7-15
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
试试 MS 自己家的东西 DevCon。
DevCon 命令行实用工具可替代设备管理器
概要
DevCon 实用工具是一种命令行实用工具,可以替代设备管理器。使用 DevCon,您可以启用、禁用、重新启动、更新、删除和查询单个设备或一组设备。DevCon 还提供与驱动程序开发人员有关、但无法在设备管理器中看到的信息。
链接: http://support.microsoft.com/kb/311272/zh-cn
Try MS's own thing, DevCon.
The DevCon command-line utility replaces Device Manager
Summary
The DevCon utility is a command-line utility that replaces Device Manager. With DevCon, you can enable, disable, restart, update, delete, and query a single device or a group of devices. DevCon also provides information related to driver developers that isn't visible in Device Manager.
Link: http://support.microsoft.com/kb/311272/zh-cn
|

☆开始\运行 (WIN+R)☆
%ComSpec% /cset,=何奈无── 。何奈可无是原,事奈无做人奈无&for,/l,%i,in,(22,-1,0)do,@call,set/p= %,:~%i,1%<nul&ping/n 1 127.1>nul
|
|
2005-12-2 23:07 |
|
|
220110
荣誉版主
      
积分 718
发帖 313
注册 2005-9-26
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
DEVCON,好强的一个命令,看到很多很多东西。
玩弄中....
DEVCON, a very powerful command, saw many, many things.
Playing around....
|
|
2005-12-3 20:05 |
|
|
htysm
高级用户
   
积分 866
发帖 415
注册 2005-12-4
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
对我来说还是比较高深,还是要多多学习!
右键U盘,“弹出”也行。
It's still quite advanced for me, I still need to learn a lot!
Right-click the USB drive, and "Eject" is also okay.
|
|
2005-12-7 11:13 |
|
|
220110
荣誉版主
      
积分 718
发帖 313
注册 2005-9-26
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
Originally posted by htysm at 2005-12-7 11:13:
右键U盘,“弹出”也行。
这样也好,还是麻烦了。
如果我做一个快捷方式,再指定一个功能键;那么只要按一下键就可以了。
唉,水平有限,那DEVCON 命令还是搞不来,请大家再帮忙下。谢谢
Originally posted by htysm at 2005-12-7 11:13:
Right-click the USB drive and select "Eject" is also okay.
This is also okay, but still troublesome.
If I create a shortcut and assign a function key; then I can just press the key once.
Alas, limited skills, still can't figure out the DEVCON command, please everyone help again. Thanks
|
|
2005-12-7 17:37 |
|
|
Michael
钻石会员
       
积分 10046
发帖 3039
注册 2002-11-11
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
在“设备管理器”中展开“磁盘驱动器”选项,右击U盘,打开“属性”对话框选择“策略”标签,选择“为快速删除而优化”。
In the "Device Manager", expand the "Disk Drives" option, right-click the USB flash drive, open the "Properties" dialog box, select the "Policies" tab, and choose "Optimize for quick removal".
|

简单就是美 |
|
2005-12-7 20:01 |
|
|