Windows command line path

This question may seem counter.

The path for the Windows command line command line is different for several windowed OSs. I would like to know if there is a command that I can enter on the command line that will output the path to the command line.

+3
source share
2 answers

The environment variable COMSPECcontains this information. It seems to be available sequentially from the ancient days of MS-DOS. ( Wikipedia article )

echo %COMSPEC%

C:\Windows\System32\cmd.exe

Please note that it can be freely changed with SET COMSPEC=, so it is not 1000% reliable.

+5
source

script, which.bat, ( Unix which whereis):

@for %%e in (%PATHEXT%) do @for %%i in (%1%%e) do @if NOT "%%~$PATH:i"=="" echo %%~$PATH:i

, cmd, :

> which.bat cmd
C:\WINDOWS\system32\cmd.exe
+1

Source: https://habr.com/ru/post/1769994/


All Articles