-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
better specify the cmdline interpreter #11833
Conversation
This solves a possible confusion in between the cmdline interpreter and the possible folder named "cmd"' for the ShellExecute WINAPI.
Kind of a dumb question, but what about if there is a
|
It is a legitimate question, ShellExecute then really tries to open any file named "cmd.exe" from the dir selected (e.g. from the "faw_test" dir example mentioned in the issue). So if somebody copies there e.g. the Windows "notepad.exe" file, renames it to the "cmd.exe", then the Windows Notepad will be opened instead of the command prompt requested.
Yes, when we use "%WINDIR%\System32\cmd.exe" instead of my current "cmd.exe". I tried that and it works ok. But there is still something I need to understand - during my testing I have found that there is a N++ GUIConfig for this cmdline interpreter, which I cannot find in the N++ GUI or in the correspondent "config.xml": commandLineInterpreter And at the next line is a hard-coded comparison to |
Luckily the documentation is kept up really well. https://npp-user-manual.org/docs/preferences/#preferences-for-advanced-users It is for advanced users that want to manually change the interpreter in the config file themselves. |
I do that:
Cheersl |
And the next one... What happens now with a folder named |
Yes, the "cmd.exe" folder will be opened in the explorer. My latest version ("%WINDIR%\System32\cmd.exe") solves even that (I checked). |
PowerEditor/src/Parameters.h
Outdated
@@ -46,6 +46,7 @@ | |||
|
|||
#endif | |||
|
|||
#define CMD_INTERPRETER TEXT("%WINDIR%\\System32\\cmd.exe") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better use constants in C++, instead of defines ?
const TCHAR cmdInterpreter[] = TEXT("%WINDIR%\\System32\\cmd.exe");
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is equivalent (the above #define...
will become the same const TCHAR*
).
Only a suggestion: You can also use the environment variable %COMSPEC%. Then you get directly the command line interpreter which can be different in mixed x86/x64 systems. |
Nice, that is even better, it works ok. (x86/x64 was not a problem before - the WinOS redirector handles that for 32/64-bit apps) I hope this is the final version, I will be computer-free until next weekend. |
Fixes #11818 .
This solves a possible confusion between the cmdline interpreter and the possible folder named "cmd"' for the ShellExecute WINAPI.