Jump to content

Recommended Posts

Posted

Hi im new to autoit and i was just wondering if it can be used to run a .reg and .bat files..... if so how?

Cheers,

Hilmy

Posted

Look up Run() and ShellExecute()

Thanks for the quick response,

ShellExecute() worked like a charm, but run() didnt work. Here is what i got:

run("CFProdEnterprise.reg")
ShellExecute("3-CF_Prod_Trust.cmd")
Posted

be careful with how you use them...read help file carefully. I think you want to use Run() with the .bat and ShellExecute() with the .reg, but I've never used ShellExecute with a reg file before. If you use Run() with the .bat, maybe you can use Run("REG IMPORT XXX.REG") or something like that. Experiment with it, I can't at the moment otherwise I would try.

Posted

be careful with how you use them...read help file carefully. I think you want to use Run() with the .bat and ShellExecute() with the .reg, but I've never used ShellExecute with a reg file before. If you use Run() with the .bat, maybe you can use Run("REG IMPORT XXX.REG") or something like that. Experiment with it, I can't at the moment otherwise I would try.

Excellent it worked!!! Thanks foryour help!

Posted

You're welcome, but keep in mind using this method doesn't guarantee it's going to work. Referring particularly to the Run() on the .reg file, there's no way to tell if it worked using this method unless you add some more code for checking it.

Posted

Is there any reason you can't use RegWrite instead of .reg files?

You could completely rewrite the batch file in AutoIt too.

Good point... if you are the one writing the original reg file in the first place, using RegWrite would be the better way to go if you choose to use AutoIt for this.

Same with the batch file, if you're the original creator and you still want to use AutoIt then rewriting in AutoIt would be better.

Even better is if the batch and reg file are being using for the same task/job, just rewrite everything in AutoIt.

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
×
×
  • Create New...