Forum Discussion

aa1's avatar
aa1
Contributor
5 years ago
Solved

Run a bat file from network does not work

Hi,   I am trying to use wshshell to run a bat file from cmd but somehow I cannot get it right. All I am doing is do a cd\ on the cmd to get back to local and then browse the network path. Do I n...
  • tristaanogre's avatar
    5 years ago

    Rather than use "CD", set the CurrentDirectory property on the WshShell object.

     

    For that matter... you don't need to instantiate the shell object... TestComplete provides a wrapper.  I don't think, either, that you need to use the CMD /K anywhere in this... you just need to indicate the batch file to run... which is, I assum, the contents of the "path" variable.

     

    var path = "\\\abc.local\\def\\Clickonce\\AB\\stg\\xyz.temp.Desktop.application";
      WshShell.CurrentDirectory = "C:\\" //Or whatever you want your root to be
      WshShell.Run(path);
      Delay(10000);