Jump to content
Eggsplorer

Compile exe to startup folder

Recommended Posts

Eggsplorer

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

Share this post


Link to post
Share on other sites
badcoder123

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

 

Share this post


Link to post
Share on other sites
Eggsplorer
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.

 

Share this post


Link to post
Share on other sites
Jos

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

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
badcoder123
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 

 

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

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.