Forum Discussion

pravin_k99's avatar
pravin_k99
Contributor
13 years ago

Run a DOS Command and wait till it finishes

Hello,



How to make testcomplete execute a DOS command and wail till the command finishes?



Thanks

Pravin

4 Replies

  • makh_dv's avatar
    makh_dv
    Occasional Contributor
    If your project is related to .Net one.

    A quick solution could be:



    Add to Project by Double click on it -> Properties -> CLR Bridge: System 2.0 from GAC. This will allow to use common dotNet assemblies



    use following code (JScript):

    var process = dotNET.System_Diagnostics.Process.Start_2(path);

    // OR var process = dotNET.System_Diagnostics.Process.Start_3(path, args);

    process.WaitForExit(); //infinite wait

    // OR process.WaitForExit_2(msecs);



    You can read more about Process object here:

    http://msdn.microsoft.com/en-us/library/system.diagnostics.process_members%28v=vs.90%29.aspx

    Note: JScript doesn't support method overloading, thus you'll need to check with IntellSense suffixes (like above _2, _3 etc) meanings.
  • Inok's avatar
    Inok
    Occasional Contributor
    Hi



    The .Net solution workes fine in JScript but not under vbscript. In vbscript I can start an application but can not wait till it's finished.

    The Method WaitForExit is not available in vbscript.

    My problem now I have existing projects in vbscript and as far as I know I can't mix them. Is there a way that I don't have to convert my existing vbscripts?



    Thanks.
  • Hi,



    The Method WaitForExit is not available in vbscript.


     We've received your submitted support case. The problem was in your code, not in functionality of scripting languages. Also, a situation where the list of methods supported by .NET assembly will be different depending on the language you access it from, is impossible.