Maximizing Efficiency with the Most Useful Windows 10 Commands
5 December, 2022
5
5
0
Contributors
Introduction
1. date command
date
command in Windows 10 allows you to view or set the current date on your computer. This can be useful if you need to check the date for a specific purpose, or if you need to change the date for some reason.date
command, open a command prompt window and type date
followed by the new date in the format dd-mm-yyyy
. For example, to set the date to December 6, 2022, you would use the following syntax:date 06-12-2022
date
command will simply display the current date. For example:date
/t
option to display the date in a specific format. For example:date /t
dd/mm/yyyy
. There are many other options available for the date
command, and you can use them to customize the output and display the date in the format that is most useful for you.2. comp command
comp
command in Windows 10 allows you to compare the contents of two files and see if they are identical. This can be useful if you want to ensure that two files are exactly the same, or if you want to see what the differences are between them.comp
command, open a command prompt window and type comp
followed by the names of the two files you want to compare. For example, to compare the files file1.txt
and file2.txt
, you would use the following syntax:comp file1.txt file2.txt
comp
command will not display any output. If the files are different, the comp
command will display the line number and the specific differences between the two files./l
option to compare the files in a case-insensitive manner, so that differences in the use of upper and lowercase letters are not considered. For example:comp /l file1.txt file2.txt
comp
command, and you can use them to customize the output and compare the files in the way that is most useful for you.3. copy command
copy
command in Windows 10 allows you to copy files from one location to another. This can be useful if you want to duplicate a file, move a file to a different location, or combine multiple files into a single location.copy
command, open a command prompt window and type copy
followed by the name of the source file and the destination. For example, to copy the file file1.txt
to a new location called C:\myfolder
, you would use the following syntax:copy file1.txt C:\myfolder
file1.txt
to the C:\myfolder
directory. If the destination already contains a file with the same name, the copy
command will overwrite it./y
option to suppress the confirmation prompt that appears when you are copying a file with the same name as an existing file. For example:copy /y file1.txt C:\myfolder
file1.txt
to the C:\myfolder
directory without prompting for confirmation. There are many other options available for the copy
command, and you can use them to customize the output and copy the files in the way that is most useful for you.4. echo command
echo
command in Windows 10 allows you to display text on the screen. This can be useful for a variety of purposes, such as displaying a message to the user, testing the output of a script, or creating a batch file.echo
command, open a command prompt window and type echo
followed by the text you want to display. For example, to display the message "Hello World!", you would use the following syntax:echo Hello World!
/n
option to suppress the line break that is typically added after each echo
command. For example:echo /n Hello World!
echo
command. There are many other options available for the echo
command, and you can use them to customize the output and display the text in the way that is most useful for you.5. find command
find
command in Windows 10 allows you to search for text within files on your computer. This can be useful if you want to find a specific word or phrase in a file, or if you want to search for a pattern of text.find
command, open a command prompt window and type find
followed by the text you want to search for and the name of the file you want to search in. For example, to search for the word "hello" in the file file1.txt
, you would use the following syntax:C:\> find "hello" file1.txt
file1.txt
for the word "hello", and will display any lines that contain the word. You can also use the /c
option to display the number of times the search term appears in the file, or the /n
option to display the line numbers of the lines that contain the search term. For example:C:\> find /c /n "hello" file1.txt
file1.txt
for the word "hello", and will display the number of times the word appears in the file, as well as the line numbers of the lines that contain the word. There are many other options available for the find
command, and you can use them to customize the output and search for text in the way that is most useful for you.6. findstr command
findstr
command in Windows 10 allows you to search for text within files. This can be useful if you want to find a specific word or phrase within one or more files, or if you want to search for files that contain specific text.findstr
command, open a command prompt window and type findstr
followed by the text you want to search for and the names of the files you want to search in. For example, to search for the word "hello" in the file file1.txt
, you would use the following syntax:findstr hello file1.txt
file1.txt
for the word "hello" and display any lines that contain that word. You can also use the /m
option to display the name of the file in which each match was found. For example:findstr /m hello file1.txt
file1.txt
for the word "hello" and display the name of the file, as well as the line number and the matching text, for each match that is found.findstr /s /i /c:"book" *.txt
findstr
command, and you can use them to customize the output and search for text in the way that is most useful for you.findstr
command looks similar to the find
command, and why we need another command when we already have find
. But here's the catch: findstr
also adds support for regular expressions, making it more similar to the grep
command in Linux.7. remove command
remove
command in Windows 10 allows you to delete files or folders from your computer. This can be useful if you want to free up space on your hard drive, or if you want to get rid of unnecessary or unwanted files.remove
command, open a command prompt window and type remove
followed by the name of the file or folder you want to delete. For example, to delete the file file1.txt
, you would use the following syntax:remove file1.txt
file1.txt
from your computer. If the file is in use, the remove
command will display an error message and will not be able to delete the file./f
option to force the deletion of a file, even if it is in use. For example:remove /f file1.txt
file1.txt
from your computer, even if it is in use. There are many other options available for the remove
command, and you can use them to customize the output and delete files in the way that is most useful for you.8. rename command
rename
command in Windows 10 allows you to change the name of a file or folder on your computer. This can be useful if you want to give a file or folder a more descriptive or meaningful name, or if you want to change the file extension to match the file type.rename
command, open a command prompt window and type rename
followed by the current name of the file or folder and the new name. For example, to rename the file file1.txt
to file2.txt
, you would use the following syntax:rename file1.txt file2.txt
file1.txt
to file2.txt
. If the new name already exists, the rename
command will display an error message and will not be able to rename the file./a
option to change the attributes of a file, in addition to its name. For example:rename /a file1.txt file2.txt
file1.txt
to file2.txt
, and will also change the attributes of the file, such as the read-only or hidden status. There are many other options available for the rename
command, and you can use them to customize the output and rename files in the way that is most useful for you.9. where command
where
command in Windows 10 allows you to search for files or folders on your computer. This can be useful if you are looking for a specific file or folder, but you are not sure where it is located.where
command, open a command prompt window and type where
followed by the name or partial name of the file or folder you are looking for. For example, to search for all files or folders that contain the word "hello", you would use the following syntax:where *hello*
/r
option to search subdirectories, as well as the current directory. For example:where /r *hello*
where
command, and you can use them to customize the output and search for files in the way that is most useful for you.10. whoami command
whoami
command in Windows 10 allows you to view your current user account. This can be useful if you want to confirm which user account you are currently logged in with, or if you want to find out more information about your user account.whoami
Linux command, which allows Linux users to see the currently logged-in user, it may look similar but it works a little bit differently on Windows. Let's take a closer look at how it works.whoami
command, open a command prompt window and type whoami
. This will display the name of your current user account, as well as the domain name and the security identifier (SID) of the account. For example:C:\> whoami myusername\mydomain S-1-5-21-1234567890-1234567890-1234567890-1234
myusername\mydomain
, and will also display the SID of the account. You can also use the /upn
option to display the user principal name (UPN) of your user account. For example:C:\> whoami /upn myusername@mydomain.com
myusername@mydomain.com
. There are many other options available for the whoami
command, and you can use them to customize the output and view more information about your user account.11. path command
path
command in Windows 10 allows you to view or modify the list of directories that are searched for command line executables. This can be useful if you want to add a new directory to the search path, or if you want to remove a directory from the search path.path
command, open a command prompt window and type path
. This will display the current search path, which is a list of directories that are searched for executables when you enter a command at the command prompt. For example:C:\> path PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Windows\system32
, C:\Windows
, C:\Windows\System32\Wbem
, and C:\Windows\System32\WindowsPowerShell\v1.0\
./p
option to add a new directory to the search path, or the /d
option to remove a directory from the search path. For example, to add the directory C:\myfolder
to the search path, you would use the following syntax:C:\> path /p C:\myfolder
C:\myfolder
to the search path, and will allow you to run executables from that directory by simply typing their name at the command prompt. There are many other options available for the path
command, and you can use them to customize the search path in the way that is most useful for you.12. set command
set
command modifies the current shell's (the window's) environment values, and the change is available immediately, but it is temporary. The change will not affect other shells that are running, and as soon as you close the shell, the new value is lost until such time as you run set againset
command, open a command prompt window and type set
. This will display a list of all the environment variables on your computer, along with their current values. For example:C:\> set ALLUSERSPROFILE=C:\ProgramData APPDATA=C:\Users\myusername\AppData\Roaming CommonProgramFiles=C:\Program Files\Common Files COMPUTERNAME=MYCOMPUTER ...
set
command followed by the name of the variable and the new value. For example, to change the value of the TEMP
environment variable, you would use the following syntax:C:\> set TEMP=C:\myfolder
TEMP
environment variable to C:\myfolder
, which will be used by programs that require a temporary directory. There are many other options available for the set
command, and you can use them to customize the environment variables in the way that is most useful for you.13. setx command
setx
command in Windows 10 allows you to create or modify environment variables for your user account or for the system. Environment variables are values that contain information about the environment in which a program runs, such as the directories that are searched for executables, the default editor, or the default printer. The setx
command is similar to UNIX utility SETENV
setx
command modifies the value permanently, which affects all future shells, but does not modify the environment of the shells already running. You have to exit the shell and reopen it before the change will be available, but the value will remain modified until you change it again.setx
command, open a command prompt window and type setx
followed by the name of the environment variable you want to create or modify and the new value. For example, to create a new environment variable called MYVAR
with the value hello
, you would use the following syntax:C:\> setx MYVAR hello
MYVAR
with the value hello
. To modify an existing environment variable, you can use the same syntax. For example, to change the value of the TEMP
environment variable, you would use the following syntax:C:\> setx TEMP C:\myfolder
TEMP
environment variable to C:\myfolder
, which will be used by programs that require a temporary directory.setx
command creates or modifies environment variables for the user account that is currently logged in. To create or modify environment variables for the system, you can use the /m
option. For example:C:\> setx /m MYVAR hello
MYVAR
with the value hello
, and will make it available to all user accounts on the computer. There are many other options available for the setx
command, and you can use them to customize the environment variables in the way that is most useful for you.14. sort command
sort
command in Windows 10 allows you to sort the lines of a text file alphabetically or numerically. This can be useful if you want to organize the lines in a text file, or if you want to compare the contents of two text files.sort
command, open a command prompt window and type sort
followed by the name of the text file you want to sort. For example, to sort the lines in the file file1.txt
, you would use the following syntax:C:\> sort file1.txt
file1.txt
alphabetically, and will display the sorted lines on the screen. You can also use the /r
option to sort the lines in reverse order, or the /o
option to save the sorted lines to a new file. For example:C:\> sort /r /o file2.txt file1.txt
file1.txt
in reverse order, and will save the sorted lines to a new file called file2.txt
. There are many other options available for the sort
command, and you can use them to customize the output and sort the lines in the way that is most useful for you.15. title command
title
command in Windows 10 allows you to change the title of the command prompt window. This can be useful if you want to identify the window by a more descriptive or meaningful title, or if you want to customize the appearance of the window.title
command, open a command prompt window and type title
followed by the new title you want to use. For example, to change the title of the window to "My Command Prompt", you would use the following syntax:C:\> title My Command Prompt
/u
option to make the title appear in uppercase letters, or the /l
option to make the title appear in lowercase letters. For example:C:\> title /u MY COMMAND PROMPT
title
command, and you can use them to customize the appearance of the command prompt window in the way that is most useful for you.16. tree command
tree
command, open a command prompt window and type tree
followed by the path of the folder or drive you want to display and this is one of my favorite command which I use mostly. For example, to display the directory structure of the C:\
drive, you would use the following syntax:tree C:\
C:\
drive, including all of its subfolders and files. You can also use the /f
option to display the full path of each file, and the /a
option to display hidden files and folders. For example:tree C:\ /f /a
C:\
drive, including hidden files and folders, with the full path of each file displayed. There are many other options available for the tree
command, and you can use them to customize the output and display the information that is most useful for you.I appreciate you taking the time to read this blog post. If you found it useful, please consider sharing it with others who may benefit from the information. Thanks again for reading! 👋
develevate
toolstipstricks