1. Start the command prompt
To enter the CMD commands, proceed as follows: Press the key combination Windows-R and enter the command CMD in the Run window and press the Enter key. This procedure also works with older Windows versions. In Windows 10, you can also enter the command CMD in the search field next to the Windows icon. This is also the right way if you have to start the command prompt with administrator rights, because then Windows 10 shows the option “Run as administrator”.
Power Shell:
Microsoft is moving the Power Shell, a greatly improved form of the command prompt, more to the fore in Windows 10. You can see that in the context menu of Windows Explorer. If you want to start the command prompt in such a way that its path is located in the current folder of Windows Explorer, you could previously hold down the Shift key in Windows Explorer and click with the right mouse button on a free space – i.e. not on a file . The command “Open command prompt here” was then in the context menu that opened. In Windows 10, however, the command “Open Powershell window here” can be found here. If you need the CMD, you can still select the command “Open Powershell window here”. Then just enter CMD there. You can then execute all CMD commands as usual. Further information about CMD and Power Shell can be found in the box.
Differences between Command Prompt and Power Shell
The CMD command prompt offers many useful commands that can also be summarized in a batch file. So you can build small mini-programs from several commands. However, the command prompt has narrow limits, especially when it comes to configuring Windows. It simply lacks a lot of commands, and even batch files are not very interactive. That is why Microsoft developed the Power Shell, which has been available since 2006 and became an integral part of Windows 7 in 2009. The Power Shell offers significantly more commands and options for configuring Windows. This also includes the power shell’s ability to script and its object-oriented processing. A command does not deliver text as a result, but an object that can be edited with another command. So professionals can handle complex system tasks with the Power Shell.
The Power Shell is downward compatible. Everything you can do in the CMD prompt also works in the Power Shell. However, the syntax is different. That is why you have to switch the Power Shell into a kind of CMD mode for most of the CMD commands. To do this, enter the command in the Power Shell
followed by Enter. As a result, the “PS” disappears in front of the path. The Power Shell now processes every CMD command. To exit this mode, enter exit. Now the “PS” appears again in front of the path.
If you only want to execute a single CMD command in Powershell, then put CMD / c in front. So roughly:
Experienced power shell users will not, however, think of using CMD commands in the power shell. Because everything that works in the command prompt has flexible equivalents in Powershell. The result of the CMD command “dir / s” can be displayed in the Powershell as follows:
gci -File -Recurse oder gci -r |% FullName oder gci -r | Out-Host -Paging
As you can see, there are many ways to read information in the Power Shell. You will find an introduction to the most important PowerShell commands and their syntax
here
.
Windows
With the following CMD commands you can get more out of Windows or complete many tasks faster than with the user interface.
2. Determine the Windows version
If you would like to know which version of Windows is installed on your computer, enter
at the command prompt. An information window opens with the current version number.
3. Cleaning up for professionals
Windows file cleanup contains hidden delete options that can only be used with a CMD command. Start the command prompt with administrator rights and enter this command:
cleanmgr /sageset:65535 /sagerun:65535
The familiar Disk Cleanup window appears, but it now offers a few additional options.
4. Sleep with a double click
Windows can also be switched to “energy saving” mode by double-clicking. First test this in the command prompt with the command:
rundll32.exe powrprof.dll,SetSuspendState Sleep
If that worked, create a desktop shortcut with this command. To do this, click with the right mouse button on the desktop and select “New -› Shortcut ”. Enter the complete command above and select “Next”. Assign a name of your choice, such as “Sleep”, and select “Finish”. A double click on the new shortcut sends Windows to sleep.
To assign a shortcut key to the action, right-click the new shortcut, select Properties and enter, for example, Ctrl-Alt-L in the “Shortcut Key” field.
5. Show username
If you enter the command whoami (English for “Who am I”), Windows displays the name of the current user account. Caution: only works correctly with the local user account.
6. Repair system files
If your PC is plagued by system crashes, it may be due to a defective system file. Use the sfc command to check all Windows system files and replace defective files or incorrect versions with the correct ones:
7. Activate the hidden account
There is a hidden administrator account in Windows 10. To activate it you need a command prompt with administrator rights. There you enter this command:
net user administrator /active:yes
Now you can log into Windows again and select the “Administrator” account and use it without a password. If you no longer need the administrator account, you can deactivate it again as follows:
net user administrator /active:no
With this trick you could get admin rights via the safe mode in older Windows versions. This no longer works with Windows 10.
8. Colored prompt
If you would like to replace the black background of the command prompt with a color of your choice, click on the icon in the upper left corner of the CMD window and select “Properties”.
On the “Colors” tab you can choose from predefined colors, but you can also mix a color yourself. The change will only take effect the next time you call CMD.
Points 9 to 26: Further CMD commands
9
/?
Displays the available help for a command, something like this: chkdsk /?
10
CD
Changes to the specified directory, something like this: cd photos. The cd .. command changes one directory back.
11
chkdsk
The command fixes hard drive errors. He needs administrator rights, the parameter / f and the specification of the drive, something like this: chkdsk d: / f
12th
clip
Copies the output of a previous command to the clipboard. The character “|” stands between the commands, something like this: dir | clip
13
cls
Clears the display of the command prompt.
14th
date
Shows and changes the PC tag. Requires administrator rights.
15th
to you
Lists all files in the current folder.
16
getmac
Displays the MAC address of an IP address, something like this: getmac / s 192.168.0.150. Works fine for the PC’s own IP address. The firewall usually blocks information from the IP address of another PC.
17th
hostname
Displays the computer name.
18th
md
Create a folder like this: md “Photos 2021”. Without the quotation marks, the two folders “Photos” and “2021” would be created.
19th
pathping
Tests the network connection to an IP address, something like this: pathping 192.168.0.150
20th
approx
Deletes a folder if it is empty.
21st
schtasks
Displays all tasks from the Windows task scheduler.
22nd
shut down
Shuts down the PC if the / s parameter is specified. The parameter / r ensures a restart, something like this: shutdown / r
23
systeminfo
Shows the most important system information.
24
taskkill / im
Kills a process like this: taskkill / im firefox.exe
25th
tasklist
Shows all running processes.
26th
time
Shows and changes the PC time. Requires administrator rights.
9
/?
DISPLAYS THE AVAILABLE HELP FOR A COMMAND, SOMETHING LIKE THIS: CHKDSK /?
10
CD
Changes to the specified directory, something like this: cd photos. The cd .. command changes one directory back.
11
chkdsk
The command fixes hard drive errors. He needs administrator rights, the parameter / f and the specification of the drive, something like this: chkdsk d: / f
12th
clip
Copies the output of a previous command to the clipboard. The character “|” stands between the commands, something like this: dir | clip
13
cls
Clears the display of the command prompt.
14th
date
Shows and changes the PC tag. Requires administrator rights.
15th
to you
Lists all files in the current folder.
16
getmac
Displays the MAC address of an IP address, something like this: getmac / s 192.168.0.150. Works fine for the PC’s own IP address. The firewall usually blocks information about the IP address of another PC.
17th
hostname
Displays the computer name.
18th
md
Create a folder like this: md “Photos 2021”. Without the quotation marks, the two folders “Photos” and “2021” would be created.
19th
pathping
Tests the network connection to an IP address, something like this: pathping 192.168.0.150
20th
approx
Deletes a folder if it is empty.
21st
schtasks
Displays all tasks from the Windows task scheduler.
22nd
shut down
Shuts down the PC if the / s parameter is specified. The parameter / r ensures a restart, something like this: shutdown / r
23
systeminfo
Shows the most important system information.
24
taskkill / im
Kills a process like this: taskkill / im firefox.exe
25th
tasklist
Shows all running processes.
26th
time
Shows and changes the PC time. Requires administrator rights.
Files
The following CMD commands help with file management
27. Encrypt files
The Pro versions of Windows offer file and folder encryption EFS (Encrypted File System). It can be reached in Windows Explorer via “Properties → General → Advanced” for files and folders. But you can also use CMD. The following command will encrypt all JPG files in the current folder:
To decrypt, replace the parameter / e with / d. Windows Home is restricted to decrypting with / d.
28. Create a large file
If you need a large file, for example to test the speed of a USB stick, you can generate it using a CMD command. Open the command prompt and type in this command there
fsutil file createnew D:testtest.dat 1000000000
It creates an empty DAT file in the D: Test folder with a file size of around 950 MB. You can of course adjust the file size, path and file name.
29. Remove undeletable files
Sometimes a file cannot be deleted in Windows Explorer. One reason the deletion fails could be a file path that is too long. Microsoft there
on this website
six reasons why deleting files sometimes does not work. The del command with the addition ? In the path often provides a remedy.
If you want to delete the file lpt1.txt in the directory “D: Test folder”, enter this:
del „\?D:Test Ordnerlpt1.txt“
Incidentally, the file mentioned here cannot be deleted with Windows Explorer because it contains the name lpt1, which is reserved for the system.
30. Secure Erase
Files deleted and removed from the Recycle Bin are not really gone. They are still hidden from view in the free area of the hard drive. From there they can be restored with rescue tools.
If you want to prevent this, you must securely delete the free area of the hard disk. This is done by the encryption command cipher. Open the command prompt with administrator rights and enter this command:
This will clean up the free space on the C: drive and destroy any data that you have already deleted from the recycle bin. No data that is still in use is touched. The process can take a long time.
network
CMD commands are also often very helpful for tasks in the network. They are often a little longer, but can be saved in a BAT file.
31. Find out the IP address
With the command
display the IP address of your PC. If you have installed several network cards or use virtualization software, these IP addresses are also displayed.
32. Check the PC in the network
You have integrated a second PC into your network, but it does not appear in the network environment of Windows Explorer? Then you should use the ping command to check whether the other PC can at least be addressed this way. Determine the IP address of the second PC and enter the following on the first PC:
ping
33. View network connections
The command
shows all open TCP and UDP connections of the PC. The display gives you an overview of the current network connections.
34. Manage network services
With the command input
manage a whole range of functions in the Windows network. Around 20 parameters are used for this, each of which uses additional parameters. With net /? you get an overview. The use parameter is often used. This allows you to map a shared folder to a drive letter.
You can get information about use by calling
catch up.
35. Backup to a network drive
You can save your files on a network drive with a batch file and only establish the connection to this network drive for the duration of the backup. Encryption Trojans hardly have a chance of destroying the data on the network drive. A batch file can be created using a Windows editor, for example. To do this, press Windows-R and enter notepad. Enter the following lines in the editor:
net use S: \192.168.0.2Backup /user:Hans Ai7ehiz^xj#e
robocopy N:Daten S:Daten /e
The first line connects the network drive under the IP address “192.168.0.2” with the drive letter “S:” on the Windows computer. The destination is the “Data” folder in the “Backup” destination folder. The log-in with the user name “Hans” and the password “Ai7 ^ xj # e” works via the parameter “/ user”.
The “robocopy” command copies your data, and the / e parameter takes all sub-folders with it.
The line “net use S: / delete” separates the network drive from Windows once the task has been completed.
Save the notepad file under any name and enter the file extension “.bat”, for example Netzsic.bat.
Source: newsabc