Jump to content

How to run this batch file script in AutoIT?


Recommended Posts

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.

Link to comment
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")
Link to comment
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)?

Link to comment
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.
Link to comment
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?
Link to comment
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
Link to comment
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?

Link to comment
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
Link to comment
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.

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