How to Automatically SHUTDOWN Windows – From The Command Line (CMD, DOS)
The shutdown command can be used to create shutdown timers, restart your system, log out or even to open the advanced start options menu.
Welcome!
This guide is all about encrypting or decrypting files and folders from the windows command line using the cipher command.
Lets get started!
The cipher command is a built in security tool, available in the windows command line, that can be used to perform a number of operations on your files and folders.
Cipher can come in very handy if you are constancy working with important files or manage sensitive data.
That’s because cipher can be used to securely and fully encrypt and decrypt files or entire directories as well as securely wipe or overwrite deleted data making them unrecoverable.
We are going to learn how to do just that in this short guide.
If you would like to follow along, feel free to open your command line (not as an administrator) and create an empty file using the echo command and the grater than redirector as well as a folder using the mkdir command.
echo. > File.txt & Mkdir Folder
An empty file will be created at once in your current directory.
We are going to use this file to practice a number of cipher commands starting with encryption and decryption.
Using the cipher command to securely encrypt a single file is extremely easy, simply type the cipher command along withe the /e parameter followed by the name of the file.
The /e parameter stands for encrypt.
Cipher /e File.txt
Your file will immediately be encrypted.
To undo the operation and decrypt the file simply replace the /e parameter with /d, which stands for decrypt.
Cipher /d File.txt
To check whether or not your file was indeed encrypted/decrypted use the cipher command without any parameters followed by the name of your file or folder:
Cipher File.txt
The encryption status of your file or folder should appear at once.
Typing the name of your file, only works on files that are located in the same directory as your command line, to encrypt a file that’s located elsewhere, type the path to your file followed by a backward slash and the name of your file.
For example to encrypt a file named “My File.txt” in your desktop directory use the following syntax:
Cipher /e "C:\Users\\My File.txt"
Replace with your computers username.
You might have noticed that i surrounded the location of the file in quotes, that’s because the path/location to the file contains a space within it.
Had i not added the quotes, the command line would not have been be able to find my file.
That’s because the quotes tell the command line that the words separated by the spaces are not an additional parameter and are just a continuation of the location or name of our file/folder.
So remember to always wrap quotes around locations or file names that contain spaces so that the command line knows how to properly search for your file.
The command for encrypting and decrypting a folder is exactly the same.
Cipher /e Folder
Replace the /e parameter with /d to decrypt the folder instead.
This operation however will only perform the operation on the folder itself and not any of the contents inside it.
To encrypt/decrypt every item within the folder you need to use the /s parameter. Here is what the command would look like:
Cipher /e /s:Folder
The specified operation will now be performed on all the contents inside your folder as well.
So far we have been using cipher to perform an operation only a single file or folder.
We can encrypt/decrypt multiple files or folders at once either by typing their names one after the other, for example:
Cipher /e File1.txt File2.txt File3.txt
Or by using wildcards.
Wildcards are special symbols or characters that take the place of characters or words.
For example to encrypt or decrypt every text file, in your current directory, that has the word “file” in its name type the following:
Cipher /e File*.txt
Apart from encrypting/decrypting every text file, you can even use a wildcard to decrypt every file and folder in your current directory.
Cipher /e *
To encrypt/decrypt every file of a different directory type the location of the directory followed by a backwards slash and the asterisk wildcard.
Cipher /e "C:\Users\Desktop\*"
Replace with your computers name.
Apart from encrypting or decrypting files, cipher can be used to wipe/override all your empty space, making deleted data completely unrecoverable.
To do so use cipher with the /w parameter along with the name of the drive you want to overwrite.
Cipher /wC:\
Keep in mind that this operation will take quite a long time to complete, to cancel use Control + C.
Its recommended that you close every other application when wiping data so that cipher can overwrite as much data as possible.
You can also wipe the deleted data of a specific directory. For example:
Cipher /wC:\Users\\Desktop
Replace with your computers name.
Check whether a file is encrypted.
Cipher File.txt
Encrypt a file.
Cipher /e File.txt
Decrypt a file.
Cipher /d File.txt
Decrypt a file named My File that’s located at the desktop directory. Replace with your computers name.
Cipher /e "C:\Users\\Desktop\My File.txt"
Encrypt the a folder along with every item within it.
Cipher /e /s:Folder
Decrypt every text file in the current directory.
Cipher /d *.txt
Overwrite all the empty data on the C drive.
Cipher /wC:\
Overwrite all the empty data on the desktop directory.Replace with your computers name.
Cipher /w"C:\Users\\Desktop\*"
You now know how to encrypt or decrypt your files and directories directly from the command prompt.
If you liked this short guide take a look at a few of our other posts related to the windows command line, or if you really liked it consider enrolling in our video course where you will learn the ins and outs of the Windows command Line.
This course has everything you need to start learning about the windows command line along with batch scripting.
The shutdown command can be used to create shutdown timers, restart your system, log out or even to open the advanced start options menu.
File associations are the references between extensions, and file types.Using the Assoc command we can view or change these file associations from the CMD.
Easily delete files, folders & directories from the command prompt (cmd), with just a few simple commands in your current as well as different directories.
Learn the Windows command line And Become an Expert!