Jump to content

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


Recommended Posts

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

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
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...