|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Batch file to Safely Remove Hardware and then Log OffI have a co-worker that forgets to run Safely Remove Hardware to stop her iPod before she logs off at the end of the day, so then she logs back on to stop her iPod and then logs off again. I was going to create a 2-line batch file that would first run Safely Remove Hardware and then log her off. I already know the command prompts to accomplish both task, but I have 2 questions concerning this: 1. In this batch file, if I first run Safely Remove Hardware, will Log Off run immediately after that, or will the batch file pause and wait for the user to finish with and close Safely Remove Hardware and then run Log Off? If it will not automatically pause, how can I get it to? 2. I would like Safely Remove Hardware to show up only when there is hardware connected that can be/needs to be stopped. How can I get it to "poll the system" to check if there is hardware that can be stopped before displaying? The commands I intend to use are: RunDll32.exe shell32.dll,Control_RunDLL hotplug.dll (from http://ask-leo.com/safely_remove_hardware_where_did_the_icon_go_how_do_i_safely_remove_hardware_without_it.html) C:\WINDOWS\SYSTEM32\shutdown.exe -l -t 5 Thanks for any help anyone can provide, Conan Kelly *** See below.
Show quoteHide quote "Conan Kelly" <CTBarbarinNOSPAM@msnNOSPAM.comNOSPAM> wrote in message This command won't pause. You would have to insert a loopnews:pmk0j.114878$kj1.84375@bgtnsc04-news.ops.worldnet.att.net... > Hello all, > > I have a co-worker that forgets to run Safely Remove Hardware to stop her > iPod before she logs off at the end of the day, so then she logs back on > to stop her iPod and then logs off again. > > I was going to create a 2-line batch file that would first run Safely > Remove Hardware and then log her off. I already know the command prompts > to accomplish both task, but I have 2 questions concerning this: > > 1. In this batch file, if I first run Safely Remove Hardware, will Log > Off run immediately after that, or will the batch file pause and wait for > the user to finish with and close Safely Remove Hardware and then run Log > Off? If it will not automatically pause, how can I get it to? into your batch file like so: RunDll32.exe shell32.dll,Control_RunDLL hotplug.dll :again ping localhost -n 6 > nultasklist | find /i "dundll32.exe" > nul && goto again C:\WINDOWS\SYSTEM32\shutdown.exe -l -t 5 > 2. I would like Safely Remove Hardware to show up only when there is AFAIK, all hardware that requires a safe removal is visible as> hardware connected that can be/needs to be stopped. How can I get it to > "poll the system" to check if there is hardware that can be stopped before > displaying? a drive letter. You could use this command to check your drives: fsutil.exe fsinfo drives As an alternative you could use devcon.exe to disconnect the hardware automatically, without user intervention. This approach would also take care of the wait period you refer to. Have a look here for further details, and post again if unsure how to use it: http://download.microsoft.com/download/1/1/f/11f7dd10-272d-4cd2-896f-9ce67f3e0240/devcon.exe Show quoteHide quote > > The commands I intend to use are: > > RunDll32.exe shell32.dll,Control_RunDLL hotplug.dll (from > http://ask-leo.com/safely_remove_hardware_where_did_the_icon_go_how_do_i_safely_remove_hardware_without_it.html) > C:\WINDOWS\SYSTEM32\shutdown.exe -l -t 5 > > > Thanks for any help anyone can provide, > > Conan Kelly >
Other interesting topics
Admin access to roaming profiles (existing folders)
FSRM mmc console takes 60+ minutes to load the list of quotas Tool to email if server is up or down? Who/What is sft@loader.com in our IIS Logs? MSFTPSVC Event 10 Printer/roaming profile/problem Which of my servers is 2003 R2? The shares permissions IPSec policy on servers connected to 2 networks OE uninstall Mic OE virus |
|||||||||||||||||||||||