Jump to content

Problem with starting program via .bat file.


Recommended Posts

I'm trying to make AutoIt to start a program using its .bat file.

I'm using: Run ("C:\Program Files\MyProgram\my.bat")

And I'm getting: "Esception in thread "main" java.lang.NoClassDefFoundError: ..." BUT everything works FINE if I just manually double click this .bat file.

Is AutoIt using it's own way or should I inlcude something else??? :)

Link to comment
Share on other sites

Try this, from the help file:

Run(@ComSpec & " /c " & "C:\Program Files\MyProgram\my.bat", "", @SW_HIDE)

Hi danwilli, Thanks for the reply and tip! I tried it before (but I used SW_SHOW instead) - the command prompt window (which start along with my application) will be shown just for the very brief moment (so now I don't even know in this case if I'm getting the error and/or which one) and my program will not start in either case. :) .

Any other ideas/suggestions?

Link to comment
Share on other sites

Or use: ShellExecute() with his syntax above. :)

Thanks R6V2! I tried your suggestion - but getting "Windows cannot find 'C:\WINDOWS\system32\cmd.exe /c C:\Program Files\MyProgram\my.bat'..."

BTW what is "/c" used for??

But I tried to use the same path (C:\Program Files\MyProgram\my.bat) via cmd and I got the same error "NoClassDefFound". So the problem is clearly not with how AutoIt handle it but with my settings.

Link to comment
Share on other sites

Actually we just found how to make it works (in case someone else will need it :)):

Run ("C:\Program Files\MyProgram\my.bat", "C:\Program Files\MyProgram")

But if someone can clarify for me what is "/c" used for - that would be nice :)

Link to comment
Share on other sites

But if someone can clarify for me what is "/c" used for - that would be nice :)

Open a command prompt and type CMD /? for details. Win 9x would be Command /? or you could even try %comspec% /?.

...

/C Carries out the command specified by string and then terminates

/K Carries out the command specified by string but remains

...

Link to comment
Share on other sites

I'm trying to make AutoIt to start a program using its .bat file.

I'm using: Run ("C:\Program Files\MyProgram\my.bat")

And I'm getting: "Esception in thread "main" java.lang.NoClassDefFoundError: ..." BUT everything works FINE if I just manually double click this .bat file.

Is AutoIt using it's own way or should I inlcude something else??? :)

well, why don't you just post my.bat, so we get at least a chance to figure out what possibly causes the problem....

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

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