Vbs run program




















Thank you for reply. You went to a lot of trouble to download the program and test it, which was above and beyond, and very kind of you. Unfortunately I think my wording about me testing the command in CMD gave the impression that I wanted the final result to also be run within a console. This is not what was intended. I have therefore reworded my question for clarity. ShellExecute "application", "parameters", "dir", "verb", window See this documentation for explanation of the parameters.

Here's what I wrote: CreateObject "Shell. If I remove the parameter part and just run the executable, the window opens, so I know that part works but that bit worked in my original script anyway. But as soon as I add required the switch, it won't work. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Any and all help is most appreciated. Thank you. Shell" Call WshShell. The WshShell object's Run method doesn't have a "working directory" setting, so you will need to set the working directory yourself before calling the Run method.

To do this, set the WshShell object's CurrentDirectory property to the directory you want before calling the Run method. Incidentally, regarding the script comment:. It is not recommended to use On Error Resume Next unless you're going to trap potential errors.

Otherwise, it will just skip errors you should otherwise see. Bill thank you so much for the reply. I am a totally rookie when is comes to scripting. Cna you provide me some sample code on how to set the working directory? Thank you so much. Great I got that one working thank you both so muc for the help. Note that not all programs make use of this information. Boolean value indicating whether the script should wait for the program to finish executing before continuing to the next statement in your script.

If set to true , script execution halts until the program finishes, and Run returns any error code returned by the program. If set to false the default , the Run method returns immediately after starting the program, automatically returning 0 not to be interpreted as an error code.

The Run method returns an integer. The Run method starts a program running in a new Windows process. You can have your script wait for the program to finish execution before continuing. This allows you to run scripts and programs synchronously. Like Article. Next VBScript Introduction. Recommended Articles. Article Contributed By :. Easy Normal Medium Hard Expert. Writing code in comment? Please use ide. Load Comments.



0コメント

  • 1000 / 1000