Forum Discussion

bschwass's avatar
bschwass
Occasional Contributor
4 years ago
Solved

WshShell "The system cannot find the file specified"

Use of the WshShell in our test suite has suddenly stopped working and I cannot figure out why. 

I have written a simple test to hone in on the error:

function test() { //Don't check this in
    WshShell.Exec("dir")
}

 

Running this function pops up the error

Shell is the name of the script I have written this function in. It definitely does exist at the path specified (though I find it strange there's no file extension in the error).

 

TestComplete is running as admin. This error seems to be happening no matter what the command is. 

To be totally honest, I don't fully understand how WshShell works. If there is something in the properties of the project that need to be setup in order for it to work there's a good chance that's been accidentally broken, but I can't find anything anywhere telling me what that setup is, so I can't check. 

 

Any help would be appreciated. 

 

5 Replies

    • anupamchampati's avatar
      anupamchampati
      Frequent Contributor

      Just remove the " " from the dir, it is been treated as String because of that.

      Just pass the dir as Para.
      function test()
      {
       WshShell.Exec(dir)
      }

      • bschwass's avatar
        bschwass
        Occasional Contributor

        I believe treating it as a string is the point? WshShell.Exec is meant to execute a string as a command I believe. Removing the quotes give the error that dir is not defined. Defining dir as a variable string results in the original error.