Sign in to follow this  
Followers 0
PieMan

Running a .reg file and .bat file

7 posts in this topic

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

Share this post


Link to post
Share on other sites



Look up Run() and ShellExecute()

Share this post


Link to post
Share on other sites

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")

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

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  
Followers 0