Why use "Cmd /c Powershell" instead of just "Powershell"?
There's no good reason to do this. In fact, the only real effect that happens is to slow things down.
People might think there is a good reason to do this. Using CMD has the following effects which can commonly be good in some cases:
- Enables internal commands, like "
DIR
" - Sets environment variables, such as the PATH variable
However, in this case, neither of those benefits are gained. Let's look at both of these scenarios:
So, there can, in some cases, be a time when using "CMD /C
" is useful. For example, if I use the external command PSEXEC
(downloaded from SysInternals), and try to run "DIR
" on a remote computer, then Windows will try to run the "DIR
" command. Windows will fail to run that command since there is no "DIR.EXE
", "DIR.BAT
", or "DIR
" file ending with another supported extension. (Supported extensions can be seen by running "ECHO %PATHEXT%
".)
However, in this scenario, if I try to run "CMD /C DIR
", then that will work, because Windows will look for an executable named "CMD
", and will find that, and then CMD
will end up successfully running the "DIR
" command which is an internal part of the "CMD
" command.
In this case, you can just run powershell
just as easily as "CMD /C powershell
", so you gain no benefit from the unnecessary "CMD /C
". The only benefit I'm seeing to going through the extra step of typing "CMD /C
" is to provide an example which will be useful if somebody decides to try modifying an example to run a command line "DIR
" or "COPY
". Having a more flexible example may be useful for some people. It's really not needed when people know what they're doing.
As for the second bullet point I provided, which is to set environment variables, that's also something that you're not actively doing in this particular case. Maybe some people think that they are helping matters by causing the PATH environment variable to be set. However, when you run commands directly (e.g., from the "Run" menu option of the Start menu), the Windows operating system may look for commands in some additional places. For instance, in Windows XP / newer you can run:
reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths"
If the command you want to run is listed under "App Paths", Windows may find the program even if it isn't in the path. So, Windows is likely to find even MORE than just what CMD would find in the PATH that CMD uses.
One possible benefit is if you wanted CMD to be run so that you could refer to an environment variable like %USERPROFILE% or %LOGONSERVER% or %TEMP%/%TMP%, but since you're not doing that, you're not needing to run "CMD /C
".
So, for your particular case: There's no good reason to do it. The effects you are achieving are having your computer do more work, slowing the process down, and using up more memory (all of which you are doing by negligible amounts on modern equipment).
Because it gets rid of the coloring.
It may be that they think people find the blue background distracting.