Problem:
When the user opens an elevated Net Express command prompt by right-clicking on 'Net Express 32-Bit Command Prompt' and clicking on 'Run as administrator', the command prompt session is created with the following error:
| 'createnv.bat' is not recognized as an internal or external command, operable program or batch file. |
The createnv.bat file is the script to set up the Net Express environment variables, and in this case, the script could not be executed.
Resolution:
Behind the Net Express 32-Bit Command Prompt shortcut, it is actually launching:
C:\\Windows\\SysWOW64\\cmd.exe /k createnv.bat
In this same shortcut, you will notice that the Start in field is to specify the current directory as "C:\\Program Files (x86)\\Micro Focus\\Net Express 5.1\\Base\\Bin\\"
In other words, the createnv.bat is executed from "C:\\Program Files (x86)\\Micro Focus\\Net Express 5.1\\Base\\Bin\\"
When running this shortcut as administrator, Windows forces the current directory to become C:\\Windows\\system32, and obviously createnv.bat cannot be found in that location.
You can also see this behavior if you open the regular "Command Prompt", it will set the current directory to C:\\Users\\YourUserID, but when "Run as administrator", it becomes C:\\Windows\\system32
This issue has already been reported to the Micro Foucs development team, but in the meantime, you may use the following workaround:
- Save createnv.txt in "C:\\Program Files (x86)\\Micro Focus\\Net Express 5.1\\Base\\Bin\\"
- Rename the original createnv.bat on your machine as createnv.bak
- Rename createnv.txt to createnv.bat
- Right-click on the Net Express 32-Bit Command Prompt shortcut
- Click on Properties
- Change the Target value from
C:\\Windows\\SysWOW64\\cmd.exe /k createnv.bat
to
C:\\Windows\\SysWOW64\\cmd.exe /k "C:\\Program Files (x86)\\Micro Focus\\Net Express 5.1\\Base\\Bin\\createnv.bat"
The above will allow to open regular and elevated Net Express 32-Bit Command Prompt with the exact same Net Express environment setup.
Note: If you are running Net Express on a 64-bit Windows, you still can follow the same instructions as above and ignore all references of SysWOW64 and (x86) in the directory structures, i.e.
- C:\\Windows\\SysWOW64 --> C:\\Windows
- C:\\Program Files (x86) --> C:\\Program Files