You might be wondering, “Why should I even bother with the Command Line?” Well, good question! The Command Line is a powerful tool that lets you control your computer with just a few keystrokes. It’s convenient for tasks like managing files, troubleshooting issues, and even automating repetitive tasks.

This guide will walk you through the essential commands, from the basics of navigating your system to more advanced techniques.

What is the command line

The command line is a view of the operating system (OS) in text format. It is also called the console or terminal. It looks like a black window with white text. Using such a program you can control your computer, programs, or external devices. This can be useful if you want to do something that GUIs don’t allow you to do. To do this, the user must enter text commands.

How to Open Command Prompt in Windows as Administrator

The command line, when opened without special settings, works in normal user mode. This means that she does not have special rights that allow her to make changes to the system. There are many ways to open the command line using keys or, for example, through search.

1. Via “Start”

Start is the main menu in Windows. It allows you to access various programs, documents, and system settings. “Start” is located in the lower-left corner of the screen and resembles a rectangle divided into four parts – this is the operating system logo. The corresponding icon can also be seen on the keyboard.

How to open the command line in Windows via Start? First, click on the OS logo icon on the taskbar or keyboard. In Windows 8 and 10, in the list of programs, select “Windows Tools”, and in Windows 11 – “All applications” → “Windows Tools”. Then find “Command Prompt” and right-click. In “Advanced” use “Run as administrator”. Then the “Do you want to allow this app to make changes on your device?” window will appear. Click Yes.

2. “Search”

Open Start, click the magnifying glass icon on the taskbar or use the search box. Type “Command Prompt” on your keyboard. Then there are two options. Either use “Run as administrator” in the list that appears on the right, or right-click on the application icon under “Best Match” on the left.

3. “Task Manager”

Right-click on the taskbar and select “Task Manager”. Or use the key combination Ctrl+Shift+Esc. Click File → Run New Task. The command line is a program, and in Windows operating systems it is called cmd. Therefore, like any other file, it can be opened through the “Task Manager”. In the new window, type cmd and leave a checkmark next to “Create a task with administrator rights.” Click OK.

A faster option: select “File”, hold down the Ctrl key and click “Run new task”.

4. System32 folder

The command line can be used through the folder where the program is stored. Open Explorer → My Computer → Local Disk (C:) → Windows → System32. Find the cmd.exe application in the folder. Right-click on it → “Run as administrator.” Another way is to select the cmd.exe application and click on “Application Tools” at the top of the Explorer window. Then select “Run as administrator”.

5. Create a Shortcut

You can also create a shortcut for cmd.exe with admin rights. Right-click on the application, select “Send to” → “Desktop (create shortcut)”. On your desktop, right-click the cmd.exe shortcut again. Select Properties → Shortcut → Advanced. Check the box next to “Run as administrator”. Confirm and launch the application.

Desktop shortcuts are created for quick access to files, folders, programs and other objects. They allow you to save time on finding and launching the necessary objects, and also simplify the organization of your workspace on the screen. With the cmd shortcut on your desktop, you can easily access the command line.

6. “Explorer”

Explorer is a file manager that allows you to manage content on your computer. With it, you can create new folders, delete old ones, copy and move files between them. Explorer also allows you to view the properties of elements, change their characteristics and perform other operations.

Open File Explorer → My Computer. Type cmd.exe in the search. When your computer finds the file, right-click on it and select “Run as administrator.”

7. “Run”

Run is an application that allows you to quickly open a program, document, or website. To open a window with a command, simultaneously press the Windows key and the R button. Type cmd in the line, and then hold down the combination Ctrl+Shift+Enter. The command line will work with admin rights.

8. PowerShell

Modern versions of Windows use a command-line-like, pumped-up PowerShell program. It has a blue background and works on a different principle. At the same time, with its help, you can both open the cmd command line and perform other tasks. Press Win+X and select “Windows PowerShell (Admin).” Or use Win+R, type powershell and press Ctrl+Shift+Enter. Then type cmd and click Enter.

What is the command line for?

The command line can be compared to hotkeys. Only they are used not for one program, but for the entire operating system. This allows you to change hundreds of computer settings using the command line. And also take advantage of useful programs without leaving one window. Here are some of the most popular tasks.

1. Computer diagnostics

The command line allows you to fix errors in Windows. A special scan helps restore damaged or deleted system files. To run diagnostics, enter sfc /scannow at the command prompt. The window cannot be closed until the operation is completed.

2. System Restore

You can check your computer’s hard drive for errors. To do this, use the chkdsk C command. Instead of C, you can specify the letter of another drive. For additional actions, you need to specify parameters. For example, the command chkdsk C: /F /R means that the computer will check drive C. The letter F means that errors will be automatically corrected, and R means that the computer will check for bad sectors and try to recover information (R).

3. Working with disks

You can also manage your computer’s disks. To do this, use the diskpart command. With its help, you can change partitions, size, names, format drives, and carry out other operations. The full list of functions can be viewed using the diskpart help command.

4. Internet check

Command Prompt allows you to see your computer’s IP address. To do this, write ipconfig. If you need to determine the MAC address, enter getmac /v. You can also check the stability of the connection. For example, write the command ping hi-tech.mail.ru. The computer will send the data to our website and determine how quickly it will be returned. This way you will know if your Internet is working. The response time will indicate the quality of the connection. A good indicator is up to 40 ms.

5. Working with folders

You can replace Command Prompt with Explorer. With its help, you can access folders. The main command is called cd. It means changing the directory. For example, to open drive C, enter cd c:\. To access the folder inside, enter cd “folder name”. If there are spaces in the path name, add quotes.

6. Working with files

You can also open files or programs. To launch applications, you need to use the same cd command as with folders. However, please include the full file name and extension at the end of the address.

7. Checking active processes

You don’t need to use Task Manager to find out what programs are open on your computer. Type tasklist in the command line and you will see a similar list. The list will display all running processes and the memory they are consuming.

Basic Command Line Operations

Let’s start with some basic command line operations. Here’s a handy table that breaks down the essential commands, how to use them, and some examples to get you going.

CommandUsageExample
cdChange directorycd C:\Users\YourName\Documents
dirList files and directoriesdir
treeDisplay directory tree structuretree C:\Users\YourName
copyCopy files from one location to anothercopy file.txt D:\Backup\file.txt
moveMove files from one location to anothermove file.txt D:\Backup\file.txt
delDelete filesdel file.txt
mkdirCreate a new directorymkdir NewFolder
rmdirRemove a directoryrmdir /S /Q OldFolder
typeDisplay contents of a text filetype file.txt
renameRename a file or directoryrename oldname.txt newname.txt
clsClear the screencls
exitClose the Command Prompt windowexit

These commands are your bread and butter for navigating and managing files and directories on your computer. Give them a try and see how they can make your tasks easier and faster!

Files and Folders Management

File and Folder management is also one of the most basic tasks that you perform on a computer. Whether you are organizing your files, backing up important data, or getting rid of files you no longer need knowing how to properly manage them can help save time and space. The Windows Command Line gives you a robust and capable set of tools to carry out many of the same jobs you can do in the GUI and some you can frequently with a finer level of control and precision, too.

At its most fundamental level, the operation of file and folder management is the basic manipulation of files and directories/files in a file system. But it doesn’t stop there. As you navigate through the file system you can also modify file attributes, set permissions, search for files, and even automate repetitive tasks with scripts. The command line lets you do this not only on your own machine but on machines connected to your network, which is a critical tool for everyday users as well as IT pros.

Automation is one of the biggest benefits of using the command line for file management. You can set things up like have a script to back up documents with the plan being executed nightly, or a batch file that can clean out temporary files for different directories in just a command.

CommandUsageExample
cdChange the current directorycd C:\Users\YourName\Documents
dirList files and directories in the current directorydir
treeDisplay directory tree structuretree C:\Users\YourName
copyCopy one or more files to another locationcopy file.txt D:\Backup\file.txt
xcopyCopy files and directories, including subdirectoriesxcopy C:\Folder D:\Backup\Folder /E
robocopyRobust file copy for mirroring directoriesrobocopy C:\Folder D:\Backup\Folder /MIR
moveMove files from one location to anothermove file.txt D:\Backup\file.txt
delDelete one or more filesdel file.txt
eraseAnother command to delete fileserase file.txt
mkdirCreate a new directorymkdir NewFolder
mdAlias for mkdirmd NewFolder
rmdirRemove a directoryrmdir /S /Q OldFolder
rdAlias for rmdirrd /S /Q OldFolder
typeDisplay contents of a text filetype file.txt
moreView file content one screen at a timemore file.txt
renameRename a file or directoryrename oldname.txt newname.txt
renAlias for renameren oldname.txt newname.txt
attribDisplay or change file attributesattrib +r file.txt
caclsDisplay or modify access control lists (ACLs)cacls file.txt /G YourName:F
icaclsDisplay, modify, backup, or restore ACLs for filesicacls file.txt /grant YourName:F
compactDisplay or alter the compression of filescompact /c file.txt
diskpartManage disks, partitions, or volumesdiskpart (and then use DISKPART commands)
takeownTake ownership of a file or directorytakeown /F file.txt
icaclsChange ownership of a file or directoryicacls file.txt /setowner YourName
findSearch for a text string in a file or filesfind "search text" file.txt
findstrSearch for strings in filesfindstr "search text" *.txt
fcCompare two files and display differencesfc file1.txt file2.txt
mklinkCreate symbolic links and hard linksmklink link.txt target.txt
fsutilFile system utility to manage volumesfsutil file createnew file.txt 1024
pushdSave the current directory and change to a new onepushd D:\Backup
popdRestore the previous directory saved by pushdpopd
substAssociate a path with a drive lettersubst X: C:\Path\To\Folder
chkdskCheck a disk and display a status reportchkdsk C: /F
cipherEncrypt or decrypt files and directoriescipher /E /S:C:\Users\YourName\Documents
recoverRecover readable information from a bad or defective diskrecover C:\Folder\file.txt
fsutilPerform tasks related to file systems or disksfsutil fsinfo drives
attribChange file attributesattrib +r -s -h file.txt
volDisplay the disk volume label and serial numbervol C:
labelCreate, change, or delete the volume labellabel C: MyDrive

These commands should give you a solid foundation for managing files and folders on your Windows system.

Disks Management

Disk management is an important factor to keep your computer healthy and fast. Whether you are setting up a new system or upgrading storage or trying to fix a problem, a good understanding of disk management commands can be very beneficial. Windows Command Line has powerful set of tools that help in doing disk related things very quickly and almost 100% achieve the level of preciseness.

Disk management is a domain that includes specially partitioning, formatting, and checking your physical drive health. Command-line tools allow you to have more control and flexibility over these processes compared to using graphical interfaces only.

Partitioning is also one of the main functions in disk management. Partitions carve up the physical disk into distinct sections that can be managed individually. This enables you to better organize the data and can increase the system efficiency. You could also specify different partitions for the OS, Apps, and Home folders, for example The command line supplies commands to create, destroy, and manipulate these partitions with great accuracy.

CommandUsageExample
diskpartEnter DiskPart command interpreter for managing disks and partitionsdiskpart
list diskList all disks connected to the system (within DiskPart)list disk (after starting DiskPart)
select diskSelect a specific disk to work with (within DiskPart)select disk 0
list partitionList partitions on the selected disk (within DiskPart)list partition
select partitionSelect a specific partition to work with (within DiskPart)select partition 1
create partitionCreate a new partition (within DiskPart)create partition primary size=10240
delete partitionDelete a selected partition (within DiskPart)delete partition
extendExtend the volume of the selected partition (within DiskPart)extend size=2048
shrinkShrink the volume of the selected partition (within DiskPart)shrink desired=1024
assignAssign a drive letter or mount point to the selected partition (within DiskPart)assign letter=E
removeRemove a drive letter or mount point (within DiskPart)remove letter=E
formatFormat a disk or partitionformat E: /FS:NTFS /Q
chkdskCheck a disk and display a status reportchkdsk C: /F
defragDefragment a diskdefrag C:
diskperfManage disk performance countersdiskperf -y
convertConvert a volume from one file system to anotherconvert E: /FS:NTFS
fsutilPerform tasks related to file systems or disksfsutil fsinfo drives
mountvolCreate, delete, or list a volume mount pointmountvol E: /D
vssadminManage Volume Shadow Copy Servicevssadmin list shadows
diskraidGUI-based disk management tooldiskraid
wmicUse Windows Management Instrumentation Command to manage diskswmic diskdrive get status
sfcSystem File Checker to scan and repair protected system filessfc /scannow
dismDeployment Image Servicing and Management tool to service Windows imagesdism /Online /Cleanup-Image /RestoreHealth
bcdeditManage Boot Configuration Databcdedit /enum
diskshadowCreate and manage volume shadow copiesdiskshadow
diskmgmt.mscOpen Disk Management consolediskmgmt.msc (Run command)
partassistPartition Assistant command line utilitypartassist /cmd=cre /pri /size=10240 /disk=1
get-diskPowerShell command to get disk informationGet-Disk
new-partitionPowerShell command to create a new partitionNew-Partition -DiskNumber 1 -Size 10GB -DriveLetter E
format-volumePowerShell command to format a volumeFormat-Volume -DriveLetter E -FileSystem NTFS -NewFileSystemLabel "Data"
resize-partitionPowerShell command to resize a partitionResize-Partition -DriveLetter E -Size 20GB
repair-volumePowerShell command to repair a volumeRepair-Volume -DriveLetter C -OfflineScanAndFix

System Information

Knowing how to find and control your computer system information is important for making your performance stay primo, fixing your problems, or making sure your system can run specific software and tasks. The Windows Command Line includes a suite of more than 280 individual commands that you can use to display detailed information about your system’s hardware and software configuration.

System information includes such data points as the CPU, memory, storage, and network interfaces, and various aspects of the system like the operating system, which software is installed, and what processes are running. Easily accessible information that can be used to make informed decisions on upgrades, diagnose performance bottlenecks, and troubleshoot other issues with the system.

CommandUsageExample
systeminfoDisplay detailed system informationsysteminfo
hostnameShow the computer’s hostnamehostname
verDisplay the Windows versionver
wmic os getRetrieve various OS informationwmic os get Caption, Version, BuildNumber
wmic biosGet BIOS informationwmic bios get Manufacturer, Name, Version
wmic cpuDisplay CPU informationwmic cpu get Name, NumberOfCores, NumberOfLogicalProcessors
wmic memorychipRetrieve memory informationwmic memorychip get Capacity, Manufacturer, Speed
wmic diskdriveGet information about disk driveswmic diskdrive get Model, Size, Status
msinfo32Open the System Information toolmsinfo32 (Run command)
dxdiagOpen the DirectX Diagnostic Tooldxdiag (Run command)
tasklistList all running processestasklist
tasklist /svcList services hosted in each processtasklist /svc
tasklist /mList all DLL modules loaded by each processtasklist /m
taskkillTerminate a running processtaskkill /PID 1234
netstatDisplay network connections, routing tables, and interface statisticsnetstat -an
ipconfigDisplay IP configurationipconfig
ipconfig /allShow detailed IP configurationipconfig /all
ipconfig /releaseRelease all IP addressesipconfig /release
ipconfig /renewRenew all IP addressesipconfig /renew
pingTest connectivity to a network hostping google.com
tracertTrace the route packets take to a network hosttracert google.com
getmacDisplay MAC addresses for network adaptersgetmac
netshConfigure and display network settingsnetsh interface ip show config
whoamiDisplay the currently logged-in userwhoami
echo %username%Display the current usernameecho %username%
powercfg /batteryreportGenerate a battery report (laptops)powercfg /batteryreport
powercfg /energyGenerate a system energy reportpowercfg /energy
gpresult /RDisplay Resultant Set of Policy (RSOP) for user and computergpresult /R
net userDisplay user account informationnet user
systeminfo /S <computer>Retrieve system information from a remote computersysteminfo /S remotePC
query userDisplay information about user sessions on a terminal serverquery user
sc queryDisplay information about running servicessc query
sc qcDisplay configuration information for a servicesc qc servicename
schtasksDisplay scheduled tasksschtasks /query /fo LIST /v
reg queryDisplay registry informationreg query HKLM\Software\Microsoft\Windows\CurrentVersion
fsutil fsinfoDisplay file system informationfsutil fsinfo drives

Network Commands

Setting up and maintaining network configurations helps maintain solid connectivity and high performance in your computer systems. From setting up a small home network to troubleshooting connectivity issues over a VPN Windows Command Line commands offer a robust set of tools help you to manage and diagnose your network related tasks.

There are many network components and settings which are done when you install an operating system (OS) to your machine, in this guide I will only talk a little about IP address configuration. Being able to control these components via the command line can not only strengthen the stability of your network, it also offer more power and freedom compared to GUIs.

CommandUsageExample
ipconfigDisplay IP configurationipconfig
ipconfig /allShow detailed IP configurationipconfig /all
ipconfig /releaseRelease all IP addressesipconfig /release
ipconfig /renewRenew all IP addressesipconfig /renew
ipconfig /flushdnsFlush DNS resolver cacheipconfig /flushdns
ipconfig /displaydnsDisplay DNS resolver cacheipconfig /displaydns
pingTest connectivity to a network hostping google.com
ping -tPing a host continuouslyping -t google.com
ping -nPing a host a specific number of timesping -n 10 google.com
tracertTrace the route packets take to a network hosttracert google.com
tracerouteAlias for tracert on some systemstraceroute google.com
pathpingCombine ping and tracert to locate network issuespathping google.com
netstatDisplay network connections, routing tables, and interface statisticsnetstat -an
netstat -eDisplay Ethernet statisticsnetstat -e
netstat -rDisplay routing tablenetstat -r
netstat -sDisplay per-protocol statisticsnetstat -s
arpDisplay and modify the ARP cachearp -a
nslookupQuery the DNS to obtain domain name or IP address mappingnslookup google.com
routeDisplay and modify the IP routing tableroute print
route addAdd a static route to the routing tableroute add 192.168.1.0 mask 255.255.255.0 192.168.1.1
route deleteDelete a route from the routing tableroute delete 192.168.1.0
getmacDisplay MAC addresses for network adaptersgetmac
netshConfigure and display network settingsnetsh interface ip show config
netsh wlanManage wireless networksnetsh wlan show profiles
netsh advfirewallManage Windows Firewall settingsnetsh advfirewall set allprofiles state off
nbtstatDisplay NetBIOS over TCP/IP statistics and resolve NetBIOS namesnbtstat -a computername
telnetConnect to a remote host using Telnettelnet towel.blinkenlights.nl
ftpTransfer files to/from a remote host using FTPftp ftp.example.com
sftpSecurely transfer files to/from a remote host using SFTPsftp user@example.com
sshSecurely connect to a remote host using SSHssh user@example.com
netCommand for network operationsnet view
net viewView network resourcesnet view \\servername
net useConnect to or disconnect from a shared resourcenet use Z: \\servername\sharename
net userManage user accountsnet user username /add
net startStart a network servicenet start servicename
net stopStop a network servicenet stop servicename
net shareCreate and manage shared resourcesnet share sharename=C:\Path\To\Folder
netsh interfaceConfigure network interfacesnetsh interface ipv4 set address "Local Area Connection" static 192.168.1.100 255.255.255.0 192.168.1.1
netsh lanManage local area network settingsnetsh lan show profiles
netsh int ip resetReset TCP/IP stacknetsh int ip reset resetlog.txt

Applications and Processes

Being able to manage applications and processes is a key skill that will help prevent your operating system from bogging down, and that will keep you in control of what your computer is doing at all times. For troubleshooting non-responsive applications, performance optimization or process control and resource management, the Windows Command Line provides various tools to manage such efficiently and that too, in a proper way.

An application is just a piece of software that you use on a computer – like a web browser, your favorite word processing app, or a game. Processes, alternatively, are running program instances. Every running app is represented by one or more processes, not just the primary executable, but any supporting processes or background services.

CommandUsageExample
startStart a program or open a documentstart notepad.exe
tasklistDisplay a list of currently running processestasklist
taskkillTerminate a running processtaskkill /PID 1234
taskkill /IMTerminate a process by its nametaskkill /IM notepad.exe
wmic process listDisplay detailed information about processeswmic process list brief
wmic process whereFilter and display process informationwmic process where "name='notepad.exe'" get ProcessId
taskmgrOpen Task Managertaskmgr
sc queryDisplay information about running servicessc query
sc startStart a servicesc start servicename
sc stopStop a servicesc stop servicename
sc configConfigure a servicesc config servicename start= auto
net startStart a network servicenet start servicename
net stopStop a network servicenet stop servicename
schtasksSchedule commands and programs to run at a specific timeschtasks /create /tn "MyTask" /tr "C:\Path\To\Program.exe" /sc daily /st 09:00
atSchedule commands and programs to run at a specific time (deprecated)at 14:00 /interactive "C:\Path\To\Program.exe"
powershellRun PowerShell commands or scriptspowershell Start-Process notepad
runasRun a program as another userrunas /user:administrator cmd
shutdownShutdown or restart the computershutdown /r /t 0
logoffLog off the current userlogoff
msgSend a message to another usermsg username "Your message here"
sfcSystem File Checker to scan and repair protected system filessfc /scannow
dismDeployment Image Servicing and Management tool to service Windows imagesdism /Online /Cleanup-Image /RestoreHealth
get-processPowerShell command to get a list of processesGet-Process
stop-processPowerShell command to stop a processStop-Process -Name notepad
start-processPowerShell command to start a processStart-Process -FilePath "C:\Path\To\Program.exe"
get-servicePowerShell command to get the status of servicesGet-Service
start-servicePowerShell command to start a serviceStart-Service -Name servicename
stop-servicePowerShell command to stop a serviceStop-Service -Name servicename
restart-servicePowerShell command to restart a serviceRestart-Service -Name servicename
set-servicePowerShell command to change the startup type of a serviceSet-Service -Name servicename -StartupType Automatic
wmic serviceDisplay detailed information about serviceswmic service get name, startmode, state
wmic service whereFilter and display service informationwmic service where "name='servicename'" get startmode, state

Command Line Setup

Prepare Command Line EnvironmentThis is something basic and every one should do if you ever need to take help of Windows Command Line. Configuring your command line to fit in with your workflow will make the experience of using CLI much more pleasant — no matter whether you are a developer, system administrator or just a casual user.

The command line (Command Prompt is another name for this) is a classic text-based user interface where you can execute commands by giving text instructions. The command line provides more precision and power than graphical interfaces which allow you to perform complex tasks with a few keystrokes. Tailoring and setting up your command line environment the way you want it can help you work faster and automate everyday tasks, or just create the best possible environment for the way you work.

CommandUsageExample
promptCustomize the command prompt appearanceprompt $P$G
colorChange the color of the command prompt text and backgroundcolor 0A
titleSet the title of the Command Prompt windowtitle My Custom Command Prompt
clsClear the command prompt screencls
doskeyCreate command aliases and recall command historydoskey ls=dir /B
setSet or display environment variablesset PATH=C:\MyPrograms;%PATH%
echoDisplay messages or turn command echoing on or offecho Hello, World!
chcpDisplay or set the active code page numberchcp 65001
modeConfigure system devices, like setting the window sizemode con: cols=120 lines=30
assocDisplay or modify file extension associationsassoc .txt=txtfile
ftypeDisplay or modify file types used in file extension associationsftype txtfile=C:\Windows\System32\NOTEPAD.EXE %1
pathDisplay or set the search path for executable filespath C:\MyPrograms;%path%
regManage the registry from the command linereg add HKCU\Software\MyApp /v MyValue /t REG_SZ /d MyData
setxSet environment variables permanentlysetx PATH "C:\MyPrograms;%PATH%"
powershellLaunch PowerShell from the Command Promptpowershell
cmdkeyManage stored usernames and passwordscmdkey /add:server /user:username /pass:password
compCompare the contents of two files or sets of filescomp file1.txt file2.txt
fcCompare two files and display the differencesfc file1.txt file2.txt
treeDisplay the directory structure of a drive or pathtree C:\ /F
runasRun a program as another userrunas /user:administrator cmd
schtasksSchedule commands and programs to run at a specific timeschtasks /create /tn "MyTask" /tr "C:\Path\To\Program.exe" /sc daily /st 09:00
shutdownShutdown or restart the computershutdown /r /t 0
taskkillTerminate a running processtaskkill /PID 1234
tasklistDisplay a list of currently running processestasklist
wmicWindows Management Instrumentation Command to manage various system settingswmic path win32_computersystem get name
attribDisplay or change file attributesattrib +r -s -h file.txt
caclsDisplay or modify access control lists (ACLs) of filescacls file.txt /G username:F
icaclsDisplay, modify, backup, or restore ACLs for files and directoriesicacls file.txt /grant username:F
gpupdateUpdate Group Policy settingsgpupdate /force
gpresultDisplay Resultant Set of Policy (RSOP) for a user or computergpresult /R
systeminfoDisplay detailed configuration information about the computer and its operating systemsysteminfo
verDisplay the Windows versionver
hostnameDisplay the name of the current computerhostname
whoamiDisplay the current usernamewhoami
schtasksSchedule tasks to run automaticallyschtasks /create /tn "Backup" /tr "C:\BackupScript.bat" /sc weekly /d Sun /st 02:00

Tips for Setting Up Your Command Line Environment

  1. Customizing the Prompt: Use the prompt command to make your command prompt more informative or fun. For example, prompt $P$G sets the prompt to display the current directory followed by a greater-than sign (>).
  2. Changing Colors: The color command changes the text and background colors of the command prompt. For instance, color 0A sets the background to black and the text to light green.
  3. Setting Environment Variables: Use the set command to define environment variables for the current session and setx to set them permanently. This is useful for adding directories to your PATH or setting other environment-specific values.
  4. Creating Aliases: The doskey command allows you to create shortcuts for longer commands. For example, doskey ls=dir /B makes the ls command function like dir /B.
  5. Window Size and Buffer: Adjust the window size and buffer with the mode command. For instance, mode con: cols=120 lines=30 sets the command prompt window to 120 columns wide and 30 lines tall.
  6. Persistent Changes: Use the setx command to make permanent changes to environment variables, which ensures your custom setup remains even after rebooting.
  7. Launching PowerShell: If you need more advanced scripting capabilities, you can switch to PowerShell by simply typing powershell in the command prompt.
  8. Task Scheduling: Automate tasks using the schtasks command to schedule scripts or programs to run at specific times.

Conclusion

We hope this cheat sheet for the Windows Command Line helps you a little to complete your tasks as quickly and efficiently as possible. It is easy to confuse command prompt commands in Windows with other terminal scripting languages, but with this guide, this is all you need to regulate yourselves.

The Windows Command Line is a wonderful tool for any Windows person. It provides a degree of power and efficiency that could completely change the way you use your computer. Whether you are new to it or an expert in command prompt coding, this cheat sheet should help you perform the tasks that you require.

Shares:

Leave a Reply

Your email address will not be published. Required fields are marked *