Run cmd.exe or command.exe. To open a Microsoft MS-DOS command prompt shell window, first click the Windows Start menu (located at the very lower-left.
To execute or run a file from MS-DOS, you must run an executable file, which are .exe, .bat, or .com files. If you are uncertain which files in the current directory are executable files, use the dir command below at the MS-DOS prompt to list .exe files. You can replace .exe with .bat or .com to see those files in the current directory instead.
dir *.exe
Once you have determined the name of the executable file you want to run, type the name of the executable file at the MS-DOS prompt. For example, if the executable file is game.exe, you would type 'game' at the command line.
If you do not see the file you want to execute or are receiving an error such as 'bad command or file name,' it is likely that the file is not in the current directory. Move to the directory of the executable file and run the command again.
For example, let's assume you downloaded the executable file game.exe and it is on the Windows XP desktop. Using the cd command, you can switch to the desktop directory by typing a command similar to the example below.
cddocume~1hopedesktop
Or, if you're already in the username directory of documents and settings, you can type the command below.
cd desktop
Once in the directory with the executable, type the name of the executable.
game
Finally, it is important to realize that when running an executable file from an MS-DOS shell (running MS-DOS within Windows), the program will still use Windows to run. If you want to run any other file types, you can use the MS-DOS start command and type start <name_of_file>, where <name_of_file> is the file's name.
Additional information
- See the cd command and dir command pages for further information about each of these commands.
The black screen of the command prompt is far too dull to be the first choice for management of computer resources for most people. I personally prefer a nice graphical user interface that has all the options I need for managing my files. That said, why would anyone prefer doing file management with the command prompt?
One obvious reason could be because one is a geek, and it seems geeks sometimes like the hard way around computing. Another reason could be because understanding the command prompt liberates one and makes one stand out as a more accomplished computer user. Whatever your reasons may be, these are some basic file management commands you can carry out using the command prompt in Windows 10.
Locating the command prompt
The fastest way to open your command prompt is by pressing Win + R. This brings up a tiny popup at the bottom-left corner of your screen. In the text box type
cmd
and click OK.Once you have your command prompt open, you can try your hands on these eight file management commands.
Related: 14 Useful Command Prompt Tricks You Should Know
1. Changing Directory
Once you have your command prompt open, it points to a default location, usually your C drive.
Type
cd
followed by a space, then type the directory path you want to change to. For example, to change the directory from the default as shown above to the directory “C:UsersAfamDownloads,” I will type in the command prompt:2. Create a new file
To create a new file, the
fsutil
command is used. The following steps are important.- The directory should be changed to the desired location.
- The name and extension of the file should be declared.
- The size of the newly created file should be declared.
For example, the command:
creates a text file called “filname1” with a size of 1000KB.
3. Get time and date of file creation
To find out the time and date a file was created, use the command
dir /T:C
. For example, the command:shows the time and date “filname1” was created.
Do note that it is important to include the extension of the file while using this command, which means
dir /T:C filename1.txt
is not the same as dir /T:C filename1
.4. Show list of hidden files in a folder
To show the list of all the hidden files in a folder, follow these steps:
1. Navigate to the desired directory using the
cd
command as shown in example 1.2. Type the command
dir /A:H /B
5. Hide a file
To hide a file, change the directory to the location of the file and use the command:
Files hidden using this command cannot even be seen in File Explorer with the “Show hidden files and folders” option.
6. Unhide a file
To unhide an already hidden file, use the command:
7. Rename a file
To rename a file, change the directory to the location of the file and use the command:
This command accepts the current name of the desired file and the new name. While using this command, it is important to show the extension of the file. In this case “.txt.”
Do note that a hidden file cannot be renamed.
8. Read file content
This command basically makes you read the content of your file right on your command prompt. The steps are:
1. Navigate to the location of the desired file.
2. Type the command
more filename.txt
. “Filename should be the name of the file you want to read.Conclusion
These are rudimentary file management commands you can perform using the command prompt. It is in no way an exhaustive list, but they will provide a good starting point in your understanding of using the command prompt.