Why am I unable to execute the command "query session" from the Sys_Execute method on a 64 bit OS?
The command "Query Session" is executed from the command line to display information about Sessions on a Terminal Server. Typically if you wish to execute this command via a SilkTest; you would do so via a call to the ‘SYS_Execute’ method; like so:
However executing the above code from a SilkTest machine running on a Windows 64 bit platform will return the error:
[ ] Error: 'query' is not recognized as an internal or external command, operable program or batch file.
This error occurs because the command 'Query Session' returns no information when executed on the 32 bit version of cmd.exe (found in C:\Windows\SysWow64); however as SilkTest is a 32 bit application, it calls the 32 Bit version of command (cmd32) by default.
The same 'Query Session' command will successfully return the session details; when executed explicitly against cmd64; as shown in the following screenshot:
Therefore the solution is to use the 'mklink' system command to create a symbolic link between the 32 and 63 bit instances of cmd.exe; it is then possible to stipulate in the script, that the command should be executed specifically against cmd64: