Sign in to follow this  
Followers 0
yclee99

How to run this batch file script in AutoIT?

10 posts in this topic

Hi,

Here is the sample of my batch file script

C:\****\****\**** -j projname -p subproject -h pcname -o -nd

Note: C:\****\****\**** is an application file.

Anyone knows how to convert my batch file to .au3.

Share this post


Link to post
Share on other sites



Hi,

Here is the sample of my batch file script

C:\****\****\**** -j projname -p subproject -h pcname -o -nd

Note: C:\****\****\**** is an application file.

Anyone knows how to convert my batch file to .au3.

ShellExecute("C:\****\****\****", "-j projname -p subproject -h pcname -o -nd")

Share this post


Link to post
Share on other sites

ShellExecute("C:\****\****\****", "-j projname -p subproject -h pcname -o -nd")

Thanks a lot. It works!

My next question:

I'm using a batch file in PC1 to execute psexec to start another batch file in PC2. Can I do the same function without using batch file and psexec (eg. file1.au3 in PC1 execute file2.au3 in PC2)?

Share this post


Link to post
Share on other sites

Thanks a lot. It works!

My next question:

I'm using a batch file in PC1 to execute psexec to start another batch file in PC2. Can I do the same function without using batch file and psexec (eg. file1.au3 in PC1 execute file2.au3 in PC2)?

Yes.

Share this post


Link to post
Share on other sites

Yes.

Do you mind to teach me how to do tat? As I try search in the help, but I can't get it.

Share this post


Link to post
Share on other sites

I'm using a batch file in PC1 to execute psexec to start another batch file in PC2. Can I do the same function without using batch file and psexec (eg. file1.au3 in PC1 execute file2.au3 in PC2)?

Anyone can help me on this issue?

Share this post


Link to post
Share on other sites

Do you mind to teach me how to do tat? As I try search in the help, but I can't get it.

There are examples of this right in the install folder. The documentation the developers spent time writing is some of the best I've ever seen. It rivals that of languages that have been around for a decade.

If you really want people around here to continue to help at least spend a little time helping yourself please. Save your questions for the hard stuff that you really can't figure out on your own. I made the same mistake when I first came here until I seen how awesome the docs and examples really are.


www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org

Share this post


Link to post
Share on other sites

There are examples of this right in the install folder. The documentation the developers spent time writing is some of the best I've ever seen. It rivals that of languages that have been around for a decade.

If you really want people around here to continue to help at least spend a little time helping yourself please. Save your questions for the hard stuff that you really can't figure out on your own. I made the same mistake when I first came here until I seen how awesome the docs and examples really are.

Dude, thanks for replied my post.

I tried to search it in the help file and google it, but I still can't get the function that I want.

Maybe you can suggest me any keyword that I should search for?

Share this post


Link to post
Share on other sites

If you're an admin on the computers you're hoping to do this on, you may be able to use COM to do it (ie, the same stuff that vbscript uses)...

This is code of a .vbs file that you could use to run notepad remotely, just replace the "NameOrIPAdressOfVirtualMachine" with a valid station... If it works for you, then you should be able to find an example of it on the forums that you can use, or maybe someone will come along nice enough to translate it for you.

strComputer = "NameOrIPAdressOfVirtualMachine"
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2:Win32_Process")

    Error = objWMIService.Create("notepad.exe", null, null, intProcessID)
    If Error = 0 Then
        Wscript.Echo "Notepad was started with a process ID of " _
             & intProcessID & "."
    Else
        Wscript.Echo "Notepad could not be started due to error " & _
            Error & "."
    End If

Share this post


Link to post
Share on other sites

If you're an admin on the computers you're hoping to do this on, you may be able to use COM to do it (ie, the same stuff that vbscript uses)...

This is code of a .vbs file that you could use to run notepad remotely, just replace the "NameOrIPAdressOfVirtualMachine" with a valid station... If it works for you, then you should be able to find an example of it on the forums that you can use, or maybe someone will come along nice enough to translate it for you.

strComputer = "NameOrIPAdressOfVirtualMachine"
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2:Win32_Process")

    Error = objWMIService.Create("notepad.exe", null, null, intProcessID)
    If Error = 0 Then
        Wscript.Echo "Notepad was started with a process ID of " _
             & intProcessID & "."
    Else
        Wscript.Echo "Notepad could not be started due to error " & _
            Error & "."
    End If
Thank for that script.

Actually I was using psexec and it worked fine. Just that, I would like to my 'program' using purely AutoIT script, wonder it can be done or not?

The main reason I don't to use other script is because I want to make it simple and second reason is I'm totally noob in programming.

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