How to use Cmder in Visual Studio Code?

At work, there is an enterprise security policy in which all executable files are allowed to work only C:\Program Filesor C:\Program Files (x86).

In Visual Studio's code settings.json, using the following settings:

{
    "terminal.integrated.shell.windows": "C:\\Windows\\Sysnative\\cmd.exe",
    "terminal.integrated.shellArgs.windows": [
        "/k C:\\Program Files (x86)\\Cmder\\vendor\\init.bat"
    ]
}

... when initializing for the integrated terminal, I get the following error message:

'C:\Program' is not recognized as an internal or external command, 
operable program or batch file.

Due to the amazing Windows file and directory naming convention allowing spaces, it is difficult to specify one of the paths Program File.

VSCode doesn't like it when you escape the space character, and this code gives me an error Invalid escape character in string. When I try to change a property to this:

{
    ...
    "terminal.integrated.shellArgs.windows": [
        "/k C:\\Program\ Files\ (x86)\\Cmder\\vendor\\init.bat"
    ]
}

... The following error message appears:

'C:\ProgramFiles' is not recognized as an internal or external command,
operable program or batch file.

Finally, trying to surround the path in quotation marks as follows:

{
    ...
    "terminal.integrated.shellArgs.windows": [
        "/k \"C:\\Program Files (x86)\\Cmder\\vendor\\init.bat\""
    ]
}

... gives me this error message:

'\"C:\Program Files (x86)\Cmder\vendor\init.bat\""' is not recognized as an 
internal or external command,
operable program or batch file.

Cmder VSCode?

+20
8

, , , , , , .

Windows /X dir, :

  /X          This displays the short names generated for non-8dot3 file
              names.  The format is that of /N with the short name inserted
              before the long name. If no short name is present, blanks are
              displayed in its place.

, dir /X C:\ :

C:\>dir /X
 Volume in drive C is OSDisk
 Volume Serial Number is XXXX-XXXX

 Directory of C:\

...
08/17/2017  08:02 PM    <DIR>          PROGRA~1     Program Files
08/09/2017  03:58 PM    <DIR>          PROGRA~2     Program Files (x86)
...

PROGRA~2 Program Files (x86) settings.json VS:

{
    "terminal.integrated.shell.windows": "C:\\Windows\\Sysnative\\cmd.exe",
    "terminal.integrated.shellArgs.windows": [
        "/k C:\\PROGRA~2\\Cmder\\vendor\\init.bat"
    ]
}

Cmder :

Image Cmder successfully uploaded to the integrated VS Code terminal.

+32

- cmder .

image was from nikrolls when giving the solution

settings.json

"terminal.integrated.shell.windows": "C:\\Windows\\system32\\cmd.exe",
"terminal.integrated.shellArgs.windows": [
    "/k %CMDER_ROOT%\\vendor\\init.bat"
]

cmder github.

+7

.

Cmder ^ , , 8dot3.

:

{
    "terminal.integrated.shell.windows": "C:\\Windows\\Sysnative\\cmd.exe",
    "terminal.integrated.shellArgs.windows": [
        "/k C:\\Program Files^ (x86)\\Cmder\\vendor\\init.bat"
    ]
}


Cmder:

. Windows , C:\Program Files (x86)\Cmder. Cmder , .

Cmder , , : C:\apps\Cmder C:\tools\Cmder VS.

- Cmder , ^ , C:\\Example Directory for Test\\Cmder C:\\Example^ Directory^ for^ Test\\Cmder settings.json.

+5

. Cmder: D:\soft\cmder, !

"terminal.integrated.env.windows": {"CMDER_ROOT": "D:\\soft\\cmder"},
"terminal.integrated.shellArgs.windows": ["/k D:\\soft\\cmder\\vendor\\init.bat"],

VSCode. !

+1

https://github.com/cmderdev/cmder/wiki/Seamless-VS-Code-Integration

 "terminal.integrated.shell.windows": "cmd.exe",

  "terminal.integrated.env.windows": {
  "CMDER_ROOT": "[cmder_root]"
  },
  "terminal.integrated.shellArgs.windows": [
    "/k [cmder_root]\\vendor\\init.bat"
  ],

[cmder_root] Cmder.

"terminal.integrated.shell.windows": "C:\\Program Files\\cmder\\vendor\\git-for-windows\\bin\\bash.exe",
0

():

vscode.bat .

@echo off
SET CMDER_ROOT=C:\cmder <--your path to cmder
"%CMDER_ROOT%\vendor\init.bat"

vscode settings.json:

"terminal.integrated.shell.windows": "C:\\WINDOWS\\sysnative\\cmd.exe",
 "terminal.integrated.shellArgs.windows": ["/K", "C:\\cmder\\vscode.bat"] <-- your path

cmd cmder, cmder "terminal.integrated.shellArgs.windows".

0

, : .

"terminal.external.windowsExec": "C:\\Utils\\Cmder\\Cmder.exe",
"terminal.integrated.shell.windows": "C:\\WINDOWS\\sysnative\\cmd.exe"
"terminal.integrated.shellArgs.windows" : ["/K","C:\\Utils\\cmder\\vendor\\init.bat"],
0

, cmd, , , npm build-lint ..

, , , init.bat, sellArgs.

settings.json

"terminal.integrated.shell.windows": "cmd.exe",
"terminal.integrated.shellArgs.windows": [
    "/K C:\\SoftDev\\App\\Cmder\\vendor\\vstudio.bat"
],

C:\SoftDev\App\cmder\vendor\vstudio.bat

@echo off
if "%1" == "" (
    C:\SoftDev\App\cmder\vendor\init.bat
) else (
    cmd %1 %2 %3 %4 %5 %6 %7 %8 %9
    exit
)
0

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


All Articles