Jump to content

An executable made and compiled in AutoIti, copied to a pen drive that ibecomes plug and run?

Recommended Posts

Let me get it straight...

I've been having such a great experience with AutoIt, it helped me a lot at my work. And now, I gotta make some configurations in the BIOS of many computers at my work. So, I'd like to know,  is it possible to use AutoIt (or some programming language) to write an algorithm that when compiled and transefered to a pen drive, it's "plug and run"? 

Share this post

Link to post
Share on other sites

Yes, any AutoIt program *could* be run from a pen drive. Just make sure to test it on a computer before using it all over!

If your work allows it, you could even edit the autorun.inf file to auto-magically run the program when it's inserted. (Please note: there are security risks with autorun.inf, as the wiki article states. But, if it's allowed, why not use it for good? ;) Maybe even disable the autorun feature with your program.)

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.


My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts

Share this post

Link to post
Share on other sites

It is incredibly likely that Auto run will be blocked.  I'm pretty sure since XP SP2 autorun is not executed without user interaction (with exception of perhaps optical disc drives or emulated optical disc drives - Google U3).  

Is a network deployment solution not an option?  Certainly more ideal than walking around to a bunch of machines and touching each one - even if it's plugging in a drive and not touching the keyboard.


Share this post

Link to post
Share on other sites

Thank you guys!! I've been trying some codes and learning more about [autorun], as soon as I need, I will come with some questions or maybe some other thanks! 

@spudw2k Well, I actually don't know if and how it could be done. At there I use Configuration Manager from the System Center family, by Microsoft. Do you know some solution that works with a network deployment? And anyway, I need to go though computer to computers to make some configurations... Actually I also use some pen drives with some .exe archives that I created using autoit.

Share this post

Link to post
Share on other sites

You could have a small script running in the background on each computer that checks if a USB key or Pen drive is being inserted.  If so, if there is a special file in there (e.g. autoit.bat), it would be run immediately with a warning message before hand, so the users do are aware they will be executing some program... 

Share this post

Link to post
Share on other sites

@Fernandin I'm a bit confused. If you are using SCCM, why go to the trouble of pen drives rather than deploying your script as a package? Did I miss something?

"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!

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By ModemJunki
      So there was a topic on the General Help and Support board where the poster mentioned it was not easy to check if the system was installed with UEFI or legacy mode and it got me looking down a rabbit hole. Apparently you can't just whip up a simple WMI query to find that out.
      But I did find that you can read the output of bcdedit.exe to check if the system is using winload.efi or winload.exe, so then I got stuck because bcdedit doesn't play nice with StdoutRead. Finally I discovered that toggling Wow64DisableWow64FsRedirection would make it all work together.
      I hope this helps someone. Maybe it can be simplified, I'm no expert. 🤨
      DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1) $aArray = StringSplit(_getDOSOutput("bcdedit.exe"), @CRLF) DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 0) For $i = 1 To UBound($aArray) - 1 Select Case StringInStr($aArray[$i], 'Windows Boot Loader') And StringInStr($aArray[$i + 3], 'device partition=C:') And StringInStr($aArray[$i + 4], 'winload.efi') ConsoleWrite("UEFI mode" & @CRLF) Case StringInStr($aArray[$i], 'Windows Boot Loader') And StringInStr($aArray[$i + 3], 'device partition=C:') And StringInStr($aArray[$i + 4], 'winload.exe') ConsoleWrite("Legacy BIOS" & @CRLF) EndSelect Next Func _getDOSOutput($command, $wd = '') ; https://www.autoitscript.com/forum/topic/190249-get-result-of-shellexecute/ Local $text = '', $Pid = Run('"' & @ComSpec & '" /c ' & $command, $wd, @SW_HIDE, 2 + 4) While 1 $text &= StdoutRead($Pid, False, False) If @error Then ExitLoop Sleep(10) WEnd Return StringStripWS($text, 7) EndFunc ;==>_getDOSOutput  
    • By Skeletor
      Hi All,
      It has been bugging me for a while now. 
      Can you view the AutoIt code from within a compiled exe. Like how you can with most .Net exe's by using a certain program.
      If this is possible, how then can I secure my program (if this method exists).
    • By LoneWolf_2106
      Hi everybody,
      i want to optimize my search code, because i don't think that my solution is "acceptable" from development perspective, it might be optimized.
      I have a text file, i read it and i copy all the entries to an Array, then i have to start a search to see if a specific entry is present. I have about ten different strings to search.
      Func FileSearch($file_content_array, $search) $j=0 For $i = 0 To UBound($file_content_array) - 1 $search_result=StringInStr($file_content_array[$i],$search) If $search_result<>0 Then ReDim $searchResultArray[UBound($searchResultArray) + 1] $searchResultArray [$j] = $file_content_array[$i] $j+=1 EndIf Next Return $searchResultArray EndFunc My solution would be ok for a single search, but in case of multiple searches? would it be still good?
      I have thought to use a 2D Array, where the first column is the array-item and the second column is "yes" or "no". But what about the searches? Do i have to use 10 times the function?
      In case of questions: I have to scan a directory and check whether some files are present or not and then write into another file:"yes, it is present", "no, it is not present".
      Thanks in advance
    • By genbadger
      Hi All,
      I'm not too code savvy but I know this is a simple one! Here's my problem, I have a folder with text files containing gcode. they are appended .nc, .ngc, and .gcode randomly. I can rename them all .ngc which is my preferred file type. In these files there's lines of gcode, carrying commands for a CNC. What I need to do is remove some comments from the beginning and format the text a certain way. I'll show an example of the original file and what I need it to look like. The files can be 20 lines or 10,000 long depending on the part.
      Old text:
      ( Header 1 text                      )
      ( Header 2 text                      )
      G90   (set absolute distance mode)
      G90.1 (set absolute distance mode for arc centers)
      G17   (set active plane to XY)
      G21   (set units to mm)
      #<z_safe> =  0.250 
      #<plunge_feed> =     5 
      G0 X 17.2644 Y 1.6127
      G1 X 2.2842 Y 8.0674 F 0.01 
      G1 X 15.3642 Y 17.8133
      G1 X 17.2644 Y 1.6127
      G0 X 0.0000 Y 0.0000
      What it needs to look like:
      G0 X17.2644 Y1.6127
      G1  X2.2842 Y8.0674  <--- copy and paste above the next m05
      G1  X15.3642 Y17.8133
      G1  X17.2644 Y1.6127
      G1  X2.2842 Y8.0674  <--- pasted here
      G0 X0.000 Y0.000
      Some things to note: g90 sets absolute coordinate mode, g21 tets units to mm, g0 is first coordinate to move the tool to. 
      This is an important step: m03 is what turns on a laser. I need the first coordinate after every m03 to be copied to the line above m05 for each chunk of gcode. the very last m05 before the m02 needs to be ignored. There are multiple chunks with m03 x,ys then m05. each chunk is going to have different coordinates after the m03.
      I have no idea where to start other than find the line with the wanted string, m03. dont know how to handle m05 though... any help is very much appreciated!
    • By Kyan
      Hi, SL3NCK calculates the 7 NCK's levels used for unlocking SL3 phones.
      SL3NCK("0000000000000000000000000000000000000000", "080803080307030003010002020305")
      #pw+283037116581614+1# #pw+235518432205471+2# #pw+595388505163502+3# #pw+415333744058839+4# #pw+259299316395048+5# #pw+467723677207791+6# #pw+690485095019780+7# You can test run and see is the same code output as in the following websites:
      http://www.francesco-pompili.it/Hash2Nck.aspx http://nokia-sl3.com/nck.php #include <Crypt.au3> ; #Function# =========================================================================================================== ; Name...........: SL3NCK ; Description ...: Calculates 7 NCK levels for SL3. ; Syntax.........: SL3NCK("TARGET_HASH","MASTER_SP_CODE") ; Return values .: string with 7 levels NCK's. ; Author ........: kyan (autoIT code), oOXTCOo (PHP code). ; Remarks .......: $TargetHash is a string with 40 hex chars. $MasterSP is a string with 30 digits. ; Related .......: SimlFeistel(), _packH() ; Requeires .....: #include <Crypt.au3> ; =============================================================================================================================== Func SL3NCK($TargetHash, $MasterSP) $result = '' $MasterSP = '000000' & StringMid($MasterSP, 0 + 1, 24) For $i = 1 To 7 $hash = _packH('0' & $i & $TargetHash) $hash = StringTrimLeft(StringUpper(_Crypt_HashData($hash, $CALG_SHA1)), 2) $precode8 = StringMid($MasterSP, 0 + 1, 16) $precode7 = StringMid($MasterSP, 17 + 1, 30) For $magic = 0 To 1 $sh = _packH('0' & $magic & StringMid($hash, 0 + 1, 32) & $precode8) $sh = StringTrimLeft(StringUpper(_Crypt_HashData($sh, $CALG_SHA1)), 2) $precode = SimlFeistel($sh, $precode7) $precode7 = $precode $sh = _packH('0' & $magic & StringMid($hash, 0 + 1, 32) & $precode) $sh = StringTrimLeft(StringUpper(_Crypt_HashData($sh, $CALG_SHA1), 2) $precode = SimlFeistel($sh, $precode8, 8) $precode8 = $precode Next $final = $precode8 & $precode7 $x = 1 $nck = '' For $y = 1 To 15 $nck = $nck & StringMid($final, $x + 1, 1) $x += 2 Next $result &= '#pw+' & $nck & '+' & $i & '#' & @CRLF Next Return $result EndFunc ;==>SL3NCK Func SimlFeistel($sh, $precode, $bytes = 7) Local $result = '', $j = 0, $nck = '', $nck2 = '' While ($j < ($bytes * 2)) $nck = StringMid($sh, $j + 1, 1) & StringMid($sh, $j + 2, 1) $nck2 = StringMid($precode, $j + 1, 1) + StringMid($precode, $j + 2, 1) $prenck = Mod((Dec($nck) + Dec($nck2)), 10) $result = $result & '0' & $prenck $j += 2 WEnd Return $result EndFunc ;==>SimlFeistel Func _packH($sInput) Local $sReply = "" For $xx = 1 To StringLen($sInput) Step 2 $sReply &= Chr(Dec(StringMid($sInput, $xx, 2))) Next Return $sReply EndFunc ;==>_packH by Luigi Hope it comes handy for someone
      PS: You can't unlock a phone only with this. Google is your friend.
  • Create New...