Jump to content
Sign in to follow this  
Cyberdyne

Trying to add a reg key based on an entered variable

Recommended Posts

Cyberdyne

My script so far looks like this...

$exename = InputBox("Auto Large Pages","Enter the EXE you want to give Large Pages",".exe")
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\"&$exename"", "UseLargePages", "REG_DWORD", "00000001")
Msgbox(0, "Results", "Large Pages Enabled for "&$exename)

The second line is said to be incorrect. I don't understand what I am doing wrong, is it simply impossible to use a variable like that?

Share this post


Link to post
Share on other sites
Geir1983

Try to remove the two "" after your variable.

Share this post


Link to post
Share on other sites
Cyberdyne

EDIT: after making the changes the script completes now. But I don't see the key added in the registry. I did close regedit and reopen it just in case. Not there.

NVM, it worked. Had to compile and run as administrator. Thanks for your help!

Edited by Cyberdyne

Share this post


Link to post
Share on other sites
Palestinian

Add #RequireAdmin at the top of your script to make it run as admin everytime

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  

×

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.