kb:common:shell

# Shell

## Windows

### Batch

The Windows batch shell, commonly referred to as cmd, cmd.exe or the command prompt

Batch specific details:

• variables are enclosed by `%` signs (e.g. `%CI_DIR%`)
• NUL is the batch equivalent to the UNIX /dev/null
• the `rem` keyword is a way to comment out code

### Powershell

Windows PowerShell is a scripting engine .DLL that's embedded into multiple hosts. The most common hosts you'll start are the interactive command-line powershell.exe and the Interactive Scripting Environment powershell_ise.exe.

Powershell is the modern Windows command prompt. Usage is similar to cmd, but with a few key differences. Some UNIX commands are also supported, such as `ls`.

Powershell specific details:

• system set environment variables must have a `\$env:` prefix. Sometimes, variables must also be enclosed by quotation marks to properly function
• `out-null` is the Powershell variant of NUl or /dev/null
• to call a cmd script from Powershell use: `cmd /c “insert script or command here”`