Command Prompt Launched from TestStand Cannot Access Some Windows Directories

Updated May 31, 2019

Reported In


  • TestStand

Operating System

  • Windows

Issue Details

  • I am trying to use a TestStand call executable step type to launch a Windows Command Prompt and perform some actions. However, I have found behavior that is different between the command prompt launched by TestStand and the one that is manually launched from Windows. Basically, when I launch a command prompt in TestStand, I cannot seem to be able to access certain folders. What is preventing me from accessing these folders? 

  • When I try to access a path using the Command Prompt launched from TestStand, I receive the following error message: [CMD] The system cannot find the path specified 



When using a Call Executable sequence step in TestStand, TestStand will launch a command prompt whose bitness (32-bit or 64-bit) corresponds to that of TestStand's (ie. TestStand 32-bit launches a 32-bit command prompt, and TestStand 64-bit launches a 64-bit command prompt)

There are some folders under the
%windir% whose access is restricted to applications of a certain bitness.  If you happen to be trying to access a file or folder under the %windir%\System32 directory, you may notice that a command prompt launched from 32-bit TestStand might not be able to access some folders or files, even if they exist and can be found via the Windows Explorer or a command prompt launched directly from Windows. The main reason for this behavior is because of the way the  Windows File System Redirector  works. 

In a nutshell:

  • The %windir%\System32 directory is reserved for 64-bit applications.  

  • The %SystemRoot%\SysWOW64 directory is reserved for 32-bit applications.

  • If the 32-bit command prompt tries to access the %SystemRoot%\System32 directory, the Windows File System Redirector will  redirect it to the %SystemRoot%\SysWOW64 folder, which may or may not contain the file or folder trying to be accessed from the command prompt. Hence, this attempt could result in the  "The system cannot find the path specified" message. 

In the TestStand 32-bit, the solution is to first use a cd command to access the %SystemRoot%\Sysnative from the 32-bit launched command prompt .  This will allow the command prompt to navigate the %SystemRoot%\System32 and access files and folders under this path. 


Additional Information

If you wish you deactivate the way the redirection occurs in Windows by default, you can use a C action step to access the kernel32.dll and call the Wow64DisableWow64FsRedirection function and pass in an object reference by reference. Then execute your command prompt call executable. Then, use another C action step to call the Wow64EnableWow64FsRedirection. See the images below for details.

Sequence Steps: 

Details of one of the sequence steps:

If trying the steps doesn't solve the problem, try running TestStand as an administrator, some of these issues could be related to access permissions.  Otherwise, please contact NI Support.