Joeson Posted April 18, 2008 Share Posted April 18, 2008 (edited) And of course, it's not perfect (some autorun.inf is normal in some cd). BTW, can any body show me how to convert Windows variables (for example, %windir%), then use them in au3? Just for cleaning junk files under %temp% and other positions. for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do ( if exist %%a:\nul del/q/f/a:h %%a:\autorun.* >nul 2>nul if not exist %%a:\autorun.* echo "%%a doesn't exist any Autorun virus" ) Edited April 18, 2008 by Joeson Link to comment Share on other sites More sharing options...
MadBoy Posted April 18, 2008 Share Posted April 18, 2008 And of course, it's not perfect (some autorun.inf is normal in some cd). BTW, can any body show me how to convert Windows variables (for example, %windir%), then use them in au3? Just for cleaning junk files under %temp% and other positions. for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do ( if exist %%a:\nul del/q/f/a:h %%a:\autorun.* >nul 2>nul if not exist %%a:\autorun.* echo "%%a doesn't exist any Autorun virus" ) $all_drives = DriveGetDrive("All") If NOT @error Then For $a = 1 To $all_drives[0] If FileExists($all_drives[$a] & "\autorun.*") Then ; This means that the file autorun exists... now you decide here what to do with it MsgBox(0,"Autorun file exists",$all_drives[$a]) EndIf Next EndIf Work from there As for variables @WindowsDir, @TempDir check helpfile.. My little company: Evotec (PL version: Evotec) Link to comment Share on other sites More sharing options...
Joeson Posted April 18, 2008 Author Share Posted April 18, 2008 Well, thanks very much. But I think I can't use the variables like "@WindowsDir\Cursors", it won't work. As for variables @WindowsDir, @TempDir check helpfile.. Link to comment Share on other sites More sharing options...
MadBoy Posted April 18, 2008 Share Posted April 18, 2008 Well, thanks very much. But I think I can't use the variables like "@WindowsDir\Cursors", it won't work.You can. But you need to do it like @WindowsDir & "\Cursors" My little company: Evotec (PL version: Evotec) Link to comment Share on other sites More sharing options...
falconchips Posted February 14, 2017 Share Posted February 14, 2017 Sorry to ask about to a so old thread, but I find the above code very useful, but I cannot figure out how to use the unit info into a new command. What I want to do is take the found unit to pass to this utility (Mountusb D: Y:): mountusb "found Unit" Y: Link to comment Share on other sites More sharing options...
Developers Jos Posted February 14, 2017 Developers Share Posted February 14, 2017 It indeed would have been better to start a new thread with the code you have and what you like to accomplish. So what do you mean with "the found unit" as the above talks about checking for autorun files? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
falconchips Posted February 14, 2017 Share Posted February 14, 2017 (edited) What I want is to run mountusb.exe and change the 'D' unit found in the code for the 'Y' letter. $all_drives = DriveGetDrive("All") If NOT @error Then For $a = 1 To $all_drives[0] If FileExists($all_drives[$a] & "\autorun.*") Then ; This means that the file autorun exists... now you decide here what to do with it Run('"mountusb" "$all_drives[$a] Y:"', "") EndIf Next EndIf In the batch code above you can set %%a as variable. I want to do the same with the 'D' unit found with Autoit code. Edited February 14, 2017 by falconchips Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted February 14, 2017 Moderators Share Posted February 14, 2017 (edited) You have an issue with quotes placement, your $all_drives[$a] should be outside your quotes. Try something like this: Run('"mountusb" "' & $all_drives[$a] & 'Y:"', "") Edit: I see I kept your double-double quotes. Jos' version is probably closer to what you need. Edited February 14, 2017 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Developers Jos Posted February 14, 2017 Developers Share Posted February 14, 2017 You mean like this:? Run('mountusb "' & $all_drives[$a] & '" Y:', "") Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
falconchips Posted February 14, 2017 Share Posted February 14, 2017 Yeah!!! Thankyou all!!! It works as expected. The goal is to change the usb drive letter on Winpe boot (startnet.cmd) because I cannot find a way to set permanent environment variables in Winpe. It changes that letter as expected, but I cannot run the program so far: STARTNET.CMD call chngletter.exe w:\folder\executable.exe Winpe claims 'there is not such folder or executable' (although the letter drive has been already changed). Maybe a 'sleep' function after all autoit code? Link to comment Share on other sites More sharing options...
falconchips Posted February 14, 2017 Share Posted February 14, 2017 SOLVED!!!! In winpeshl.ini I I run startnet.cmd and it calls autoitprogram.exe (now with sleep (3000) after the code) and in the next line of Winpeshl.ini I wrote the route to the new letter drive and it works. 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