Sign in to follow this  
Followers 0
Hyflex

Trigger a RunOnce or Add a script to run on boot which self-deletes the boot entry?

2 posts in this topic

#1 ·  Posted (edited)

Hey Guys,

I have a script that I run that requires a second part to be ran after you reboot... 

How best would I do this, the file that I want to run once after the next reboot is: INPReg.exe

Obviously I could do:

RegWrite('HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce', 'P REG', 'REG_SZ', 'C:\Folder\In\PReg.exe')

 

Is there a specific way I should do it?

Edited by Hyflex

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

It looks ok to me except that you should test the return value for error.

I'm not sure which type commands need HKLM or HKCU.  I have utilities to select a file to Run or RunOnce.

With Run I use HKCU with RunOnce HKLM.  I suspect the RunOnce to HKLM might not register if the user is not

part of the Administrator Group.  But the way you are doing it with HKCU it shouldn't matter.  Unless the command

required some privilege.

Edited by MilesAhead

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
Sign in to follow this  
Followers 0