Executes a command in the command-line shell on the local

As document said : http://docs.testplant.com/?q=content/system-interaction
set the shellCommand to "ShellExecute"

shell "example.bat"

Nothing happens.
I'm using Window 10.

Comments

  • Try specifying the directory of the file.
    shell "C:\path\to\example.bat"
    
    

    Just remember that in Windows no result is returned.
  • pxpx Member
    sphennings wrote:
    Try specifying the directory of the file.
    shell "C:\path\to\example.bat"
    
    

    Just remember that in Windows no result is returned.
    still the same
    here is content of example.bat
    mkdir "VKL"
    
    Here is the result :
    11/23/15 3:29:07 PM	START		Running Selection from test.script
    Selection Executed in 0:00:00
    
  • Try specifying the directory you want to run the script from
    shell "C:\path\to\example.bat", none, "C:\path\to\run\directory\
    
    If example.bat contains 'mkdir "VKL"' then you should now have a folder
    C:\path\to\run\directory\VKL
    When using ShellExecute on Windows, several additional parameters besides the command or file may optionally be passed. The second parameter, if given, specifies any parameters to be passed to the command being run. The third parameter specifies the default working directory for the action. The fourth parameter should be a number specifying any optional flags to pass to the underlying ShellExecute() function. Finally, the fifth parameter, if given, specifies an explicit verb to use (such as "open", "explore", "edit", "find", or "print"). Otherwise the default verb defined in the registry (or "open") will be used. (When using ShellExecute, no output is returned.) If an error occurs, the result will be set to a number, otherwise it will be empty.
    You want to set the third argument of shell to the working directory of the script. To do this cleanly without passing any arguments to the batch file set the second argument to none.

    Alternatively you could specify the absolute path you want in your Batch file but that would greatly reduce the reusability of your code.
  • pxpx Member
    sphennings wrote:
    Try specifying the directory you want to run the script from
    shell "C:\path\to\example.bat", none, "C:\path\to\run\directory\
    
    If example.bat contains 'mkdir "VKL"' then you should now have a folder
    C:\path\to\run\directory\VKL
    When using ShellExecute on Windows, several additional parameters besides the command or file may optionally be passed. The second parameter, if given, specifies any parameters to be passed to the command being run. The third parameter specifies the default working directory for the action. The fourth parameter should be a number specifying any optional flags to pass to the underlying ShellExecute() function. Finally, the fifth parameter, if given, specifies an explicit verb to use (such as "open", "explore", "edit", "find", or "print"). Otherwise the default verb defined in the registry (or "open") will be used. (When using ShellExecute, no output is returned.) If an error occurs, the result will be set to a number, otherwise it will be empty.
    You want to set the third argument of shell to the working directory of the script. To do this cleanly without passing any arguments to the batch file set the second argument to none.

    Alternatively you could specify the absolute path you want in your Batch file but that would greatly reduce the reusability of your code.

    :shock: oh, thank you very much, It worked !
Sign In or Register to comment.