hot202 Posted March 9, 2010 Share Posted March 9, 2010 hi im trying to find away to eject my USB hdd on win7 but all the scripts out there dont seem to work. Dose any1 know how to get it working for win7? Link to comment Share on other sites More sharing options...
Xenobiologist Posted March 9, 2010 Share Posted March 9, 2010 Have you tried devcon.exe von commandline shell (DOSBOX) ? If that works, you can automate it. Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
hot202 Posted March 9, 2010 Author Share Posted March 9, 2010 nah i didnt know what that was and where to get it and how to use it. Link to comment Share on other sites More sharing options...
trancexx Posted March 9, 2010 Share Posted March 9, 2010 Search forums with this DeviceIoControl trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
99ojo Posted March 9, 2010 Share Posted March 9, 2010 Hi, you have to download Windows Driver Kit 7.1.0 ( 610 MB ) to get a running version of devcon.exe under Win 7. http://www.microsoft.com/whdc/DevTools/WDK/WDKpkg.mspx After extracting you will find suitable version under "%InstDrv%\WinDDK\7600.16385.0\Tools\Devcon" ;-)) Stefan Link to comment Share on other sites More sharing options...
hot202 Posted March 10, 2010 Author Share Posted March 10, 2010 so i will have to have Windows Driver Kit 7.1.0 installed on every computer that i want to eject the usb? Link to comment Share on other sites More sharing options...
wraithdu Posted March 10, 2010 Share Posted March 10, 2010 Tried my UDF HERE yet? I just updated it to make sure it works on x64. Link to comment Share on other sites More sharing options...
hot202 Posted March 10, 2010 Author Share Posted March 10, 2010 (edited) I cant seem to get it working on my win7 computer using your example in the console i keep getting Ejecting drive <G:> - False edit: is there anyway to eject the drive if the script is ran from that drive? Edited March 10, 2010 by hot202 Link to comment Share on other sites More sharing options...
99ojo Posted March 10, 2010 Share Posted March 10, 2010 (edited) so i will have to have Windows Driver Kit 7.1.0 installed on every computer that i want to eject the usb? Hi, no. you have to install it once to get the devcon.exe for Win7 32 bit and Win7 64 bit. In your code, you might have to query OS build to run the suitable devcon.exe. Here sample code to query usb stick, you have to declare $workdir by yourself: $strrun = $workdir & "\devcon find = WPD USB\VID* >" & $workdir & "\usbdev.txt" RunWait (@ComSpec & " /c " & $strrun, $workdir, @SW_HIDE) _FileReadToArray ($workdir & "\usbdev.txt", $usbdev) FileDelete ($workdir & "\usbdev.txt") and deactivate USB Stick on exit, using array $usbdev from above: Func _Exit () ;Sind USB Drives vorhanden ( are there USB Sticks ) If IsArray ($usbdev) Then For $x = 1 to UBound ($usbdev) - 1 If StringInStr ($usbdev [$x], "USB-Massenspeicher") <> 0 Then $crecords = StringSplit ($usbdev [$x], "\") ;Entferne USB Drives zum sicheren entfernern (disable USB Stick for save removal) RunWait (@ComSpec & " /c " & $workdir & "\devcon remove """ & $crecords [1] & "\" & $crecords [2] & """") EndIf Next EndIf ;Ende (Exit) Exit EndFunc ;-)) Stefan Edited March 10, 2010 by 99ojo Link to comment Share on other sites More sharing options...
Yashied Posted March 10, 2010 Share Posted March 10, 2010 Try this. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
wraithdu Posted March 10, 2010 Share Posted March 10, 2010 edit:is there anyway to eject the drive if the script is ran from that drive?Of course NOT. How can you expect to safely remove a usb drive if you have an application running from that very drive? Link to comment Share on other sites More sharing options...
hot202 Posted March 12, 2010 Author Share Posted March 12, 2010 Thought maybe there would be away to close the script but still eject the usb drive. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now