Jump to content

RunOnce


tdjb3
 Share

Recommended Posts

I am new to the forum and scripting, so I need some help. I am using RegWrite to create an entry in RunOnce, so that when a user logs in, a new script will run. For some reason, the entry for RunOnce appears to be entered (I see the prompts) and then on reboot the script does not run after logging in. The script works under XP and not 2000. I have also tried using the Run command to set off a bat file that will run regedit.exe. Below is a copy of my script.

Opt ("ExpandEnvStrings", 1)

If FileExists ("%Systemroot%\system32\jview.exe") Then

RegWrite ("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", "MicrosoftJavaRemovalCleanup", "REG_SZ", "C:\Temp\AppDeploy\Jre_1.4.2.13\MicrosoftJavaRemovalCleanup.exe" )

EndIf

If FileExists ("%Systemroot%\system32\jview.exe") Then

Else

Run ("%Systemroot%\regedit.exe c:\temp\appdeploy\Jre_1.4.2.13\SunJavaRemoval.reg")

ControlFocus ("Registry Editor","",6)

WinWaitActive ("Registry Editor","",5)

Sleep (4000)

Send ("Y")

ControlFocus ("Registry Editor","",2)

WinWaitActive ("Registry Editor","",5)

Sleep (4000)

Send ("{ENTER}")

EndIf

If FileExists ("%Systemroot%\system32\jview.exe") Then

If FileExists ("%Systemroot%\inf\java.inf") Then

Run ("%Systemroot%\system32\RunDll32.exe advpack.dll,LaunchINFSection java.inf,Uninstall")

ControlFocus ("Microsoft VM uninstall","",6)

WinWaitActive ("Microsoft VM uninstall","", 5)

Sleep (4000)

Send ("Y")

ControlFocus ("Microsoft VM uninstall","",6)

WinWaitActive ("Microsoft VM uninstall","", 5)

Sleep (4000)

Send ("!Y")

EndIf

EndIf

Sleep (3000)

Shutdown (6)

Thanks for the help.

Link to comment
Share on other sites

try this:

RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", "MicrosoftJavaRemovalCleanup", "REG_SZ", '"C:\Temp\AppDeploy\Jre_1.4.2.13\MicrosoftJavaRemovalCleanup.exe"')

this will add surround the app in "", in my experience they are required for the program to launch.

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