SinghIsKing Posted November 19, 2008 Share Posted November 19, 2008 hi all, i would like to know how can i check about drive type? i have a file in my usb flash drive and i don't want it to be run from Fixed and Cd, dvd drives. i only want it to be run from Removable devices. who can help me about it? Link to comment Share on other sites More sharing options...
Digisoul Posted November 19, 2008 Share Posted November 19, 2008 hi all, i would like to know how can i check about drive type?i have a file in my usb flash drive and i don't want it to be run from Fixed and Cd, dvd drives. i only want it to be run from Removable devices.who can help me about it?Hello SinghIsKingWelcome in Autoit forum.you can get the type of any drive by DriveGetType ( "path" )Its good for you to read the AutoIt help Manual, you will find all the functions about drives and files. 73 108 111 118 101 65 117 116 111 105 116 Link to comment Share on other sites More sharing options...
SinghIsKing Posted November 19, 2008 Author Share Posted November 19, 2008 Hello SinghIsKingWelcome in Autoit forum.you can get the type of any drive by DriveGetType ( "path" )Its good for you to read the AutoIt help Manual, you will find all the functions about drives and files.Thanks for the welcome,i have read about it but how the script will check itself if it's running from a fixed or usb drive? Link to comment Share on other sites More sharing options...
spudw2k Posted November 19, 2008 Share Posted November 19, 2008 (edited) msgbox(0,"",DriveGetType(@ScriptDir)) Edited November 19, 2008 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
SinghIsKing Posted November 19, 2008 Author Share Posted November 19, 2008 (edited) Thanks for the help, sorry for one more question. i have a file in E:\Dongle\Start.exe can i know if it is in fixed or usb drive using AutoIt Script? i tried $File = "E:\Dongle\Start.exe" msgbox(0,"",DriveGetType($File)) but it gives nothing. Edited November 19, 2008 by SinghIsKing Link to comment Share on other sites More sharing options...
November Posted November 19, 2008 Share Posted November 19, 2008 Thanks for the help, sorry for one more question. i have a file in E:\Dongle\Start.exe can i know if it is in fixed or usb drive using AutoIt Script? i tried $File = "E:\Dongle\Start.exe" msgbox(0,"",DriveGetType($File)) but it gives nothing. Hi there, Here are two examples for you, but i deeply recomend some reading in the help file a.k.a. AutoIT Bible. Feel free to try it and modify! ;Example 1 $file = FileOpenDialog("Choose file", @DesktopDir, "All (*.*)", 1) $disk = StringMid($file, 1, 2) $result = DriveGetType($disk) MsgBox (64, "Result", "The selected file is in a " & $result & " Disk") ;Example2 $test = DriveGetDrive("REMOVABLE") for $x = 1 to $test[0] MsgBox(64, "test", "Drive " & $test[$x] & " Is a Removable disk") next Cheers. Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] Link to comment Share on other sites More sharing options...
spudw2k Posted November 19, 2008 Share Posted November 19, 2008 it gives nothing.I can't imagine why that would be unless the E: drive isn't present or the path is incorrect. Try just E: Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
SinghIsKing Posted November 19, 2008 Author Share Posted November 19, 2008 (edited) I can't imagine why that would be unless the E: drive isn't present or the path is incorrect. Try just E:Test it on your pc msgbox(0,"",DriveGetType($CmdLineRaw))it will give no result. @ november hi friend, Thanks for the examples. Edited November 19, 2008 by SinghIsKing Link to comment Share on other sites More sharing options...
SinghIsKing Posted November 19, 2008 Author Share Posted November 19, 2008 no, it's not working. Link to comment Share on other sites More sharing options...
November Posted November 19, 2008 Share Posted November 19, 2008 no, it's not working.Hi again,Just explain to me... is the start.exe your script compiled or just 3rd party file?Cheers Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] Link to comment Share on other sites More sharing options...
SinghIsKing Posted November 19, 2008 Author Share Posted November 19, 2008 Hi again,Just explain to me... is the start.exe your script compiled or just 3rd party file?Cheersjust 3rd party file Link to comment Share on other sites More sharing options...
November Posted November 20, 2008 Share Posted November 20, 2008 (edited) just 3rd party fileHi again, Try this... expandcollapse popupHotKeySet("{ESC}", "over");Press ESC to exit monitoring file $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" While 1 $process = ProcessList("Start.exe") IF $process [0][0] = 0 Then ConsoleWrite("Start.exe not running, sleeping for 10 secs" & @CRLF) sleep (10000); ten secs Sleep Else $ProID = $process[1][1] Search() EndIf Sleep(50) WEnd Func Search() $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE ProcessID LIKE '" & $ProID & "'", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output &= $objItem.ExecutablePath Next ;ConsoleWrite($Output) Else ConsoleWrite("No WMI Objects Found for class: " & "Win32_Process" ) Endif $file = $Output $disk = StringMid($file, 1, 2) $result = DriveGetType($disk) If $result <> "REMOVABLE" Then ConsoleWrite($Output & " Running from a non removable disk. PID : " & $ProID & " Killed" & @CRLF) ProcessClose($ProID) Return Else ConsoleWrite($Output & " Running from a removable disk." & @CRLF) Sleep(5000);sleep 5 secs Endif $Output = "" EndFunc Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 5, 2) & "/" & _ StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2)) EndFunc Func over() Exit EndFunc Cheers Edited November 20, 2008 by november Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] Link to comment Share on other sites More sharing options...
DexterMorgan Posted November 20, 2008 Share Posted November 20, 2008 Test it on your pc msgbox(0,"",DriveGetType($CmdLineRaw))it will give no result. you probably didnt define $CMDlineRaw at the start of your script add this $CmdLineRaw = 'E:/" ; set this to what you need to define it to code Link to comment Share on other sites More sharing options...
spudw2k Posted November 20, 2008 Share Posted November 20, 2008 (edited) you probably didnt define $CMDlineRawat the start of your script add this$CmdLineRaw = 'E:/" ; set this to what you need to define it toNot to mention that throwing in command line params is gonna screw up the path. For example: running a script in SciTE uses the cmdline params '/errorstdout space "scriptfullpath"' which is not a valid "path" Edited November 20, 2008 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF 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