I have an application which is installed in x64. I want to execute this EXE in x64 command prompt.
CASE 1:
If I open the command prompt manually as Admin (Start->Type, cmd.exe->Right click->Run as Administrator
) then the EXE works fine. I get the following specifications about the Environment variables using SET
command in cmd window:
CommonProgramFiles=c:\Program Files\Common Files
CommonProgramFiles(x86)=c:\Program Files (x86)\Common Files
CommonProgramW6432=c:\Program Files\Common Files
PROCESSOR_ARCHITECTURE=AMD64
CASE 2:
If I open the Command window using a script file which elevates to the Admin rights then the EXE is not found. I get the following values for the environments variables by using SET
command:
CommonProgramFiles=c:\Program Files (x86)\Common Files
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_ARCHITEW6432=AMD64
ProgramFiles=c:\Program Files (x86)
ProgramFiles(x86)=c:\Program Files (x86)
winSysFolder=System32
Question: I have to work with Case 2. I think that the discrepancy in the paths of ProgramFiles
could be the reason of my EXE not working in the second case. How can I specify in the script that it should be executed in x64 command prompt?
PS: The link to my main problem is here.
References: The script file to elevate to Admin has been taken from Matt's answer given here.