We’ll now look at how to compare these two text files. We now have two text files that each list the files within their respective targeted folders: FolderAcontents.txt lists FolderA’s files, and FolderBcontents.txt lists FolderB’s files. To create the file that lists FolderB’s contents, type:.Let’s generate a file that lists FolderB’s contents now. NOTE: To see other options that the dir command can use, use the command “dir /?”. If the indicated file the results are being redirected to does not exist, cmd will create it. NOTE: FolderAcontents.txt did not need to exist prior to running the command. We used the ‘/b’ option, the folder name (FolderA), and the redirect to a file syntax, all in the same command. The command “dir > filename” puts the results of running the dir command in a text file, instead of inside the cmd window. The command “dir /b” uses the ‘/b’ option which lists the file and folder names, without the additional information such as date, time, and file size. The command “dir FolderA” lists the contents of FolderA, without first changing directory (cd command) to that folder. This time, we are adding a few more options to the dir command. We used the dir command in the last step in order to simply list all of the files in the current directory.
NOTE: The Windows file system is case insensitive, so typing “cd desktop” is the same as typing “cd Desktop”. ‘cd’ is the cmd’s command for “change directory.” This is how you navigate the folder structures of your storage media using the cmd.
This article will refer to the Command as simply “cmd” from here on out. Unless you ran the Command Prompt as Administrator, you should be in your default user library directory. Now that we have the Command Prompt open, you should see a blinking cursor preceded by the directory the Command Prompt is currently looking at. NOTE: If you want to compare files in protected directories, such as the Windows directory, you must run the Command Prompt as “Administrator.” You can do this by right clicking on the Command Prompt item in the Start menu (in Windows Vista, 7, and 8), and choosing “Run as administrator.” This will open the Run dialog in Windows.įrom here, type “cmd” and hit Enter.