09-29-2023 12:03 AM
You try to execute the program query.exe which is located in the system directory, in most cases it is c:\windows\system32. You are using 32 bit application and that causes a redirection to c:\windows\SysWOW64. In this folder, there is no query.exe application. You can either temporarily disable the redirection by calling Wow64DisableWow64FsRedirection and Wow64RevertWow64FsRedirection functions. Be careful with these functions. They affect all file operations of the current thread.
The other way is to point directly to the system32 folder with %windir%\Sysnative.
In your case, the command "cmd /c %windir%\Sysnative\query user" should work in both 32bit and 64bit.
09-29-2023 06:23 AM
Martin,
This worked!! Thanks so much for this, and for the detailed explanation for what was going on. I will make sure to remember this if I use System Exec vi in the future.