====== Shell/Terminals ====== ===== 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 Print variables via ''echo %VARIABLE%''. ==== 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"'' Print variables via ''$env:VARIABLE'' ==== Command Interpreter ==== C:\>cmd /? Starts a new instance of the Windows XP command interpreter > Usually you don't need to run it in a Command Prompt if it's an external command (executable, script, etc.). So if you can go to Start → Run… and run it from there, then you can run your application directly with all arguments, etc. > > However, if you're using CMD builtin features, like internal commands (dir, echo, mklink, …), the pipe (|), or I/O redirection (>, >>, <), you must run the commandline in CMD, because otherwise these features wouldn't be available. The parameter /c is just to tell CMD to terminate after the command completes. It's not required, but it's good practice to put it there, so you can easily replace it with /k (keep CMD open after the command completes) for debugging purposes. (Source: https://stackoverflow.com/questions/35802779/do-i-need-cmd-c) ==== Environment Variables ==== Setting environment variables like ''PATH'' can be done via Control Panel -> System: {{:kb:common:windows-env-var-path.png|}} ---- ==== Windows Terminal ==== "The Windows Terminal is a modern, fast, efficient, powerful, and productive terminal application for users of command-line tools and shells like Command Prompt, PowerShell, and WSL. Its main features include multiple tabs, panes, Unicode and UTF-8 character support, a GPU accelerated text rendering engine, and custom themes, styles, and configurations." //From the Microsoft Store// === Installation === The Windows Terminal is not part of a default Windows 10 installation (but in Windows 11). The easiest way to install it, is with the Microsoft Store. Search for "Terminal" and the first hit should it be. === Configuration/Settings === The Windows Terminal can be configured very extensively, and it would go way too far to explain every option. I want to introduce only a few important settings. Open the settings tab by clicking on the down arrow next to the "new-tab-plus" symbol. {{ :kb:common:screenshot_2022-08-30_121450.png?direct&600 |}} * **Defautl profile** when opening a new tab: In section "Start" direct the first setting on the top. You can select a profile on the dropdown menu. {{ :kb:common:screenshot_2022-08-30_121632.png?direct&600 |}} === Custom Profiles === All configured profiles can be modified under their profile section. The button "Add new profile" allows adding own profiles. Click on the button "New empty profile" to create a complete new one. {{ :kb:common:screenshot_2022-08-30_151910.png?direct&600 |}} You can add the Git Bash with the following settings. {{ :kb:common:screenshot_2022-08-30_152226.png?direct&600 |}}