# Windows Batch Files Table of Contents - [[#Steps|Steps]] - [[#Commands|Commands]] - [[#Examples|Examples]] - [[#Examples#State details about your computer|State details about your computer]] - [[#Examples#Open Outlook if not running for Current User, even if it is running for another user|Open Outlook if not running for Current User, even if it is running for another user]] - [[#Examples#Open Outlook if not running for Current User, if it is not running for any user|Open Outlook if not running for Current User, if it is not running for any user]] - [[#Examples#Open outlook email message GUID from clipboard in Launchy|Open outlook email message GUID from clipboard in Launchy]] - [[#Sources|Sources]] ## Steps Create file in a notepad file Save as .bat or .cmd or .btm Once File is created click or double click it to run it ## Commands ``` @ECHO OFF ``` >Shows the message on a clean line disabling the display prompt. Usually, this line goes at the beginning of the file. (You can use the command without the "@" symbol, but it's recommended to include it to show a cleaner return.) ``` ECHO ``` >The command prints the text after the space on the screen. ``` PAUSE ``` >Allows the window to stay open after the command has been executed. Otherwise, the window will close automatically as soon as the script finishes executing. You can use this command at the end of the script or after a specific command when running multiple tasks and wanting to pause between each line. ``` TITLE ``` >Prints a custom name in the title bar of the console window ``` :: ``` >Allows writing comments and documentation information. These details are ignored when the system runs the batch file. ``` START ``` >Opens an app or website with the default web browser ## Examples ### State details about your computer >[!WARNING] have not tested this yet ``` @ECHO OFF :: This batch file details Windows 10, hardware, and networking configuration. TITLE My System Info ECHO Please wait... Checking system information. :: Section 1: Windows 10 information ECHO ========================== ECHO WINDOWS INFO ECHO ============================ systeminfo | findstr /c:"OS Name" systeminfo | findstr /c:"OS Version" systeminfo | findstr /c:"System Type" :: Section 2: Hardware information. ECHO ============================ ECHO HARDWARE INFO ECHO ============================ systeminfo | findstr /c:"Total Physical Memory" wmic cpu get name wmic diskdrive get name,model,size wmic path win32_videocontroller get name wmic path win32_VideoController get CurrentHorizontalResolution,CurrentVerticalResolution :: Section 3: Networking information. ECHO ============================ ECHO NETWORK INFO ECHO ============================ ipconfig | findstr IPv4ipconfig | findstr IPv6 START https://support.microsoft.com/en-us/windows/windows-10-system-requirements-6d4e9a79-66bf-7950-467c-795cf0386715 PAUSE ``` ### Open Outlook if not running for Current User, even if it is running for another user >[!WARNING] have not tested this yet ``` @Echo Off For /F "Tokens=1" %%I In ('tasklist /FI "IMAGENAME eq OUTLOOK.EXE" /FI "USERNAME eq %Username%"') Do If /I "%%I"=="OUTLOOK.EXE" Goto :EOF Start Outlook.exe ``` ### Open Outlook if not running for Current User, if it is not running for any user >[!WARNING] have not tested this yet ``` @Echo Off For /F "Tokens=1" %%I In ('tasklist /FI "IMAGENAME eq OUTLOOK.EXE"') Do If /I "%%I"=="OUTLOOK.EXE" Goto :EOF Start Outlook.exe ``` ### Open outlook email message GUID from clipboard in Launchy >[!WARNING] have not tested this yet ``` echo off "C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE" /select %1 ``` ## Sources https://www.windowscentral.com/how-create-and-run-batch-file-windows-10