Jump to content

Compile exe to startup folder


Recommended Posts

Hi,

I'd like to run an autoit script which then compiles the following code as exe to the startup folder:

RunWait(@ComSpec & " /c " & "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File C:\UA\Scripts\win-updates.ps1 -MaxUpdatesPerCycle 100 -RestartRequired 1", "")

Func SelfDelete()
    [...]
EndFunc   ;==>SelfDelete

SelfDelete()

Is this possible? I just found how to compile the current script to a certain folder but I only want those lines above executed upon startup.
I could just compile it and copy it into the startup folder but it would be an additional step.

Thanks in advance.

Edited by Eggsplorer
Link to comment
Share on other sites

You could make the script create a file to...

"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup"

and for the SelfDelete do you want to to stop the script until next computer restart (1) or remove the script from the directory? (2)

;Example 1

HotKeySet("{F1}", "SelfDelete")

While 1 ;Makes it so script never closes
   Sleep(100)
WEnd

Func SelfDelete()
   Exit
EndFunc

or

;Example 1

HotKeySet("{F1}", "SelfDelete")

While 1 ;Makes it so script never closes
   Sleep(100)
WEnd

Func SelfDelete()
   FileDelete("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\name.exe") ;replace name with file name
   Exit
EndFunc

 

Link to comment
Share on other sites

9 hours ago, badcoder123 said:

You could make the script create a file to...

"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup"

 

But how? I want the exe to be in this exact path but how do I write the script which compiles the exe?

And I already have the SelfDelete function. I just wanted to cut a corner since it wasn't topic of my question.

 

Link to comment
Share on other sites

  • Developers

Why do you need a script to compile the exe at all? Can't you simply distribute a compiled script?

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

5 hours ago, Eggsplorer said:

But how? I want the exe to be in this exact path but how do I write the script which compiles the exe?

And I already have the SelfDelete function. I just wanted to cut a corner since it wasn't topic of my question.

 

If you're not pre-compiling it and you're try to distribute it on someone elses computer who doesn't have autoit installed it will not be possible.. However you could make it write a batch file do the startup directory 

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...