Jump to content

Small question about Run and .Reg files


Recommended Posts

Hello,

I'm trying to run a .Reg file Silently, using Run.

I succeed by this method:

Run("REGEDIT /S Test.reg")

But, I was trying to run a .Reg file from another folder silently, and nothing happend.

I was trying to do it this way:

Run("REGEDIT /S", @ProgramFilesDir & "Test.reg")

And no success :/

Why's that? I'll be glad to get help !

Thank you.

Link to comment
Share on other sites

@SuperNatural : you code cannot work because of the wrong syntax you use.

Replace Run() by ShellExecute, or change your code like this :

Run('REGEDIT /s "' & @ProgramFilesDir & '\Test.reg"')

Also #RequireAdmin is needed if the UAC is enabled

Link to comment
Share on other sites

Add 

#RequireAdmin

to code.

 

 

When doing stuff like this I always run a sanity check to make sure my path is correct

$test = (@ProgramFilesDir & "\test.reg")
ConsoleWrite("test = " & $test)

 

@SuperNatural : you code cannot work because of the wrong syntax you use.

Replace Run() by ShellExecute, or change your code like this :

Run('REGEDIT /s "' & @ProgramFilesDir & '\Test.reg"')

Also #RequireAdmin is needed if the UAC is enabled

 

First, thank you all.

jguinch - the code you changed for me works pretty well. I may run the .Reg file from a different folder, but still, can't change the HKLM (only CURRENT_USER).

That's weird, because my UAC is disabled. Also, I tried to add #RequireAdmin, but it seems nothing happend :/

Link to comment
Share on other sites

It needs to be added at the top of your script.

You can use RegWrite with autoit if it isn't a big reg file ;)

Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there's InetRead and WinHTTP, way better
happy.png

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