DOS lives! Secrets of the Windows command prompt

Don't be afraid of a little typing. Lots of good old DOS commands still work in Windows, and often they're the best choice for quick and efficient work.

1 2 3 4 5 6 7 8 Page 7
Page 7 of 8

%PROGRAMFILES% is a variable that expands to equal the location where you've installed programs on your PC. That's followed by the pathname to the PhotoViewer DLL, which must be enclosed in double quotes because it contains spaces.

IMAGEVIEW_FULLSCREEN %1

ImageView_Fullscreen is an option for the PhotoViewer program. It's followed by %1, which represents the name of the JPEG file.

Changing default file associations
You can use the ASSOC and FTYPE combination to change assignments for any type of file. Of course, you'll first need to know the full pathname to the file to run, plus any options required to load a file and properly process the information.

As an example, here's how you would setup the LOG filename extension to be opened by Notepad:

ASSOC .LOG=LOGFILE

This command associates the LOG filename extension with the LOGFILE type. Now you need to direct Windows to use Notepad when it opens LOG files. First, a cheat: See how Notepad is opened for text files, which are the TXTFILE type:

FTYPE TXTFILE

You should see something like:

TXTFILE=%SYSTEMROOT%\SYSTEM32\NOTEPAD.EXE %1

Now type:

FTYPE LOGFILE=%SYSTEMROOT%\SYSTEM32\NOTEPAD.EXE %1

You're using the same command used to open a TXTFILE, but in this case it's a LOG file you're opening. Another way to do this is to associate LOG with TXTFILE:

ASSOC .LOG=TXTFILE

But either way ends up with the same result: Notepad is run and it opens the file.

Printing a list of files in a folder

clear.gif

Another thing the command prompt can do that Windows can't is print the contents of a folder, a list of files, their names, sizes and dates. This is actually a function of the DIR command, which lists the contents of a directory:

DIR

In Windows, directory (or folder) information is displayed graphically. You can use the Details mode to see the kind of information that the DIR command displays, but you still can neither print nor easily cut and paste that list within Windows. Yet using the command prompt, it's possible -- providing that you have a printer connected directly to your PC's printer port, also called the LPT1 port. Here's the command:

DIR > PRN

The > (greater than) symbol redirects the output of the DIR command to the PRN device, your PC's default printer. Ensure that your printer is attached to the computer and ready to print, then press the Enter key.

If the page doesn't eject from the printer, then try this useful command:

ECHO ^L > PRN

Note that you create the ^L character by pressing Ctrl+L on the keyboard; don't type the character ^ and then an L, which doesn't work. The ECHO command displays the "Control-L" character, but because the > command redirects output, the ^L is "displayed" on the printer, which ejects a page.

clear.gif
clear.gif
1 2 3 4 5 6 7 8 Page 7
Page 7 of 8
7 inconvenient truths about the hybrid work trend
Shop Tech Products at Amazon