tldr/pages/windows/cmd.md

37 lines
757 B
Markdown
Raw Normal View History

2018-09-26 21:01:42 +01:00
# cmd
> The Windows command interpreter.
> More information: <https://learn.microsoft.com/windows-server/administration/windows-commands/cmd>.
2018-09-26 21:01:42 +01:00
2021-11-22 17:37:32 +00:00
- Start an interactive shell session:
2018-09-26 21:01:42 +01:00
`cmd`
2021-11-22 17:37:32 +00:00
- Execute a [c]ommand:
2018-09-26 21:01:42 +01:00
`cmd /c "{{command}}"`
2021-11-22 17:37:32 +00:00
- Execute a script:
2018-09-26 21:01:42 +01:00
2021-11-22 17:37:32 +00:00
`cmd {{path/to/file.bat}}`
2018-09-26 21:01:42 +01:00
2021-11-22 17:37:32 +00:00
- Execute a command and then enter an interactive shell:
2018-09-26 21:01:42 +01:00
2021-11-22 17:37:32 +00:00
`cmd /k "{{command}}"`
2018-09-26 21:01:42 +01:00
2021-11-22 17:37:32 +00:00
- Start an interactive shell session where `echo` is disabled in command output:
2018-09-26 21:01:42 +01:00
2021-11-22 17:37:32 +00:00
`cmd /q`
2018-09-26 21:01:42 +01:00
2021-11-22 17:37:32 +00:00
- Start an interactive shell session with delayed [v]ariable expansion enabled or disabled:
2018-09-26 21:01:42 +01:00
2021-11-22 17:37:32 +00:00
`cmd /v:{{on|off}}`
2018-09-26 21:01:42 +01:00
2021-11-22 17:37:32 +00:00
- Start an interactive shell session with command [e]xtensions enabled or disabled:
2018-09-26 21:01:42 +01:00
2021-11-22 17:37:32 +00:00
`cmd /e:{{on|off}}`
2018-09-26 21:01:42 +01:00
2021-11-22 17:37:32 +00:00
- Start an interactive shell session with used Unicode encoding:
2018-09-26 21:01:42 +01:00
`cmd /u`