Forum Discussion

vbelt11's avatar
vbelt11
New Contributor
6 years ago
Solved

Why TC12 won't trigger .exe file from "D:\" partition?

Is there any reason why TC12 will not trigger .exe file from "D:\" partition, while the same exe file is being run properly from "C:\" partition? JS is being used as a scripting language, Win10 OS. 

For an istance command: 

var rootFolderPath = "D:\\TFS TestComplete\\EMSPREREQUISITES\\AdobeReader";

Sys.OleObject("WScript.Shell").Run(rootFolderPath + "\\" + adobeFilePath.Name);

will throw an error:

"Error The system cannot find the file specified. Error location: Unit: "DVS EMS\Post Elections\Script\PrerequisiteInstallation" Line: 18 Column: 34.

Error
The system cannot find the file specified.
Error location:
Unit: "DVS EMS\Post Elections\Script\PrerequisiteInstallation"
Line: 18 Column: 34."
while the same line will execute properly when the file is on C partition:
var rootFolderPath = "C:\\AdobeReader";
Sys.OleObject("WScript.Shell").Run(rootFolderPath + "\\" + adobeFilePath.Name);
 
Any kind of suggetion is welcomed.
  • Because it's a shell basically running as a command line, it's possible that the space in the name of the directory is causing the issue.  What happens if, as a test, you put your file simply in D:\AdobeReader?  Will it work better there?

     

    If so, you might need to wrap your full path in quotes to make sure that the shell executes it properly.

     

    FYI, rather than instantiating the shell as you did, you should be able to use WshShell directly.  See 

     

    https://support.smartbear.com/testcomplete/docs/reference/program-objects/wshshell/index.html

  • vbelt11's avatar
    vbelt11
    6 years ago

    that is exactly what the issue was. thx - much appriciated!

2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Because it's a shell basically running as a command line, it's possible that the space in the name of the directory is causing the issue.  What happens if, as a test, you put your file simply in D:\AdobeReader?  Will it work better there?

     

    If so, you might need to wrap your full path in quotes to make sure that the shell executes it properly.

     

    FYI, rather than instantiating the shell as you did, you should be able to use WshShell directly.  See 

     

    https://support.smartbear.com/testcomplete/docs/reference/program-objects/wshshell/index.html

    • vbelt11's avatar
      vbelt11
      New Contributor

      that is exactly what the issue was. thx - much appriciated!