Bristle Software Windows Tips

This page is offered as a service of Bristle Software, Inc.  New tips are sent to an associated mailing list when they are posted here.  Please send comments, corrections, any tips you'd like to contribute, or requests to be added to the mailing list, to tips@bristle.com.

Table of Contents:

  1. Keyboard Tips
    1. Disable Caps Lock key
  2. Desktop Tips
    1. Windows Shortcut Keys
    2. File Associations
    3. URL Associations
    4. Open With
    5. Add to the SendTo menu
    6. Notepad as the default action for unknown file types
    7. Bypass Recycle Bin
    8. Startup Prompts
    9. Windows Task Manager
    10. Startup Locations
    11. Show window contents while dragging
  3. Start Menu Tips
    1. Add to Start Menu
    2. Add Desktop to Start Menu
    3. Delete from Start Menu
    4. Small icons in Start Menu
  4. Command Line / GUI Integration
    1. CMD Here
    2. Command Line Copy and Paste
    3. Drag to Command Line
  5. Command Line Tips
    1. Command Line Editing
    2. Command Line Completion
    3. PUSHD, POPD, CD /D, CD abc*
    4. START a File
    5. START a URL
    6. FTYPE and ASSOC
    7. Command Line Redirection
    8. XCOPY /M and /A burn out USB flash drives
    9. See Also
  6. Batch File Tips
    1. Command Extensions
    2. Pre-defined variables
    3. Parsing strings
    4. SET command
      1. SET /A - Arithmetic, bitwise, and logical operators
      2. SET /P - Prompting the user for input
    5. FOR command
      1. Expanding wildcards
      2. Expanding wildcards to match directory names
      3. Recurring over a directory tree
      4. Looping a specified number of times
      5. Looping a specified number of times more easily
      6. Reading from a file
      7. Reading from a string
      8. Parsing the output of a command
      9. EXEC.BAT: Executing any command on any set of files
    6. IF command
      1. Undocumented IF THEN ELSE
    7. Echo a blank line
    8. See Also
  7. Migration Tips
    1. Win2K vs WinNT4
      1. Win2K vs WinNT4 Applications
  8. Windows Patches
    1. Fix Windows Daylight Savings Time 2007
  9. Unix
    1. Connecting to Unix from Windows
      1. PuTTY
      2. WinSCP
    2. Running Unix on Windows
      1. Emulators
        1. Cygwin
      2. Virtualization
        1. VMWare
        2. VirtualBox
    3. Running Windows on Unix or Mac
      1. Emulators
        1. CodeWeavers CrossOver
      2. Virtualization
        1. Parallels
        2. VMWare
        3. VirtualBox
  10. Miscellaneous Tips
    1. Run non-EXE from AUTORUN.INF
    2. Why Windows Has No Security

Details of Tips:

  1. Keyboard Tips

    1. Disable CAPS LOCK key

      Last Updated:  5/8/2008
      Applies to:  WinNT 4.0, Win2K, WinXP

      Tired of accidentally bumping the CAPS LOCK key?  Want a way to disable it?

      You can cause Windows to ignore the CAPS LOCK key, or map it to another key, by making a simple registry change and then rebooting.

      To disable it:  DisableCapsLock.reg

      To map it to the Shift key:  MapCapsLockToShift.reg

      To re-enable it:  EnableCapsLock.reg

      Don't forget to re-boot afterwards.

      If clicking the above links opens the registry file in the browser window, instead of running it directly, you may have to do the following instead: right click on the link, choose the Save As option to save the file to your hard drive, double-click on the file there, and then delete the file if you like.

      Unfortunately, Windows stores the entire set of disabled and re-mapped keys in one long hex value in the registry, and each of these registry files overwrites the entire value in the registry, so if you have previously used a similar technique to disable or re-map any other keys, this will undo that previous effect. 

      For more info, see:  

              http://www.microsoft.com/whdc/archive/w2kscan-map.mspx
              http://www.webmasterworld.com/forum107/153.htm
              http://www.google.com/search?q=Keyboard+Layout+Scancode+Map

      Unfortunately, you have to reboot each time you make such a change.  Also, unfortunately, the change applies to all users of all keyboards (laptop and external, for example) of the entire computer, not just you, and not just one of your keyboards.  

      If you want something more flexible, you might consider configuring the CAPS LOCK (and Num Lock and Scroll Lock) to beep whenever you bump them via:

              Control Panel | Accessibility Options | Keyboard | Use Toggle Keys

      Then at least you'll be aware of bumping it sooner, and can bump it again.

      Credit where credit is due:  I've been using the Toggle Keys approach for over a decade.  Before that, I used to pry off the Caps Lock key with a screwdriver, or wedge something under it so I couldn't press it.  But recently I came across this technique in an article by Woody Leonhard in the paid version of the Windows Secrets newsletter (formerly Woody's Windows Watch, Woody's Office Watch, and Fred Langa's LangaList).  I definitely recommend you subscribe to the free and/or paid versions of the newsletter at:
              http://windowssecrets.com
      Woody was suggesting various freeware programs to do this, but I'm always leery of downloading and running any program where I can't see the source code.  Since he did mention the name of the registry key, I was able to research it a little, and wrote my own simple registry files.  

      Apparently, this technique has been possible since at least the year 2000.  I could easily have Googled it any time in the past few years.  Isn't it amazing the annoyances we put up with forever, never even thinking to look for a solution?

      --Fred

  2. Desktop Tips

    1. Windows Shortcut Keys

      Original Version: 1999 or so
      Last Updated: 1/2/2012
      Applies to: Win95, Win98, WinNT 4.0, Win2K, WinXP
      , Vista, Win7

      Here is a list of some of the more useful shortcut keys that apply to the Windows desktop:

      Key Desktop Function
      Alt-Tab Move to entry for most recently active application in Task List (very useful for toggling between 2 apps).  If you continue to hold down Alt and keep hitting Tab, it cycles forward through the entries.   Releasing Alt activates the selected app.
      Alt-Shift-Tab Same as Alt-Tab, but cycles backward through the apps.
      Alt-Esc Move directly to next active application
      Alt-Shift-Esc Move directly to previous active application
      Ctrl-Esc Open the Start Menu
      Ctrl-Shift-Esc Open the Task Manager
         
      Delete Delete to the Recycle Bin
      Shift-Delete Delete, bypassing the Recycle Bin
      Backspace Move to parent folder in Explorer
      Alt-Enter Open Properties window for current icon
         
      PrintScreen Copy the entire screen image to the Windows clipboard.
      Alt-PrintScreen Copy the currently active window to the Windows clipboard.
      Windows-D Clear the desktop, minimizing all windows, or restore it, if already cleared.
      Windows-E Launch Windows Explorer
      Windows-F Launch Windows Search tool

      The following modifier keys apply the following changes to the behavior of various other keys:

      Modifier Key Function
      Ctrl- Same thing, but more so (move by one word instead of one char, move to end of document, instead of to next page, etc.)
      Shift- Same thing, but reverse (search in the opposite direction, etc.)
      Shift- Extend the selection while moving

      Here is a list of some of the more useful shortcut keys that apply across most Windows applications, including the desktop itself:

      Key Function
      Arrow Move the smallest logical unit (one character, line, menu item, icon, etc.) in the specified direction.
      Ctrl-Arrow Move a larger logical unit (word, slide, cell, etc.), in the specified direction.
      Shift-Arrow Extend selection one smallest logical unit in the specified direction.
      Ctrl-Shift-Arrow Extend selection one larger logical unit in the specified direction.
         
      RightArrow Expand branch of a tree view
      LeftArrow Collapse branch of a tree view
      Alt-DownArrow Drop down a dropdown combobox
         
      Tab / Shift-Tab Move to the next/previous logical entity (table cell, form field, etc.), wrapping around as necessary.
      Ctrl-Tab /  Ctrl-Shift-Tab Move to the next/previous tab of a tabbed dialog
         
      Delete Delete one char to the left, or selected item/region
      Ctrl-Delete Delete one word to the left
      Shift-Delete Cut
      Backspace Delete one char to the right
      Ctrl-Backspace Delete one word to the right
      Insert Toggle Insert/Overstrike mode
      Shift-Insert Paste
         
      Ctrl-PgUp/PgDn Move between notebook tabs (Excel sheets/charts, FrontPage views, pages of a Properties dialog, etc.)
      Home/End Move to beginning/end of line
      Ctrl-Home/End Move to beginning/end of file
      Shift-Home/End Extend selection to beginning/end of line
      Ctrl-Shift-Home/End Extend selection to beginning/end of file
         
      Esc Cancel the current operation (abort a drag operation, close a dialog box, etc.)
      Space Click the current command button, option button, checkbox, etc.
      Alt-Space Open the system menu of the current application (restore, move, size, minimize, maximize, close, etc., plus copy/paste features in Command Prompt windows)
      Alt-Minus Open the system menu of the current window in an MDI application
         
      F1 Help
      Shift-F1 Extended Help ("What's This?" help, Language help within a language sensitive editor, etc.)
      F2 Rename
      F3 Find Next (except in MS Office apps)
      Ctrl-F4 Close window
      Alt-F4 Close application
      F5 Refresh
      Ctrl-F6/Ctrl-Shift-F6 Switch to the next/previous window in an MDI app
      F7 Spell Checker
      F10 Move to menu bar
      Shift-F10 Pop up right mouse menu
         
      Ctrl-A Select All
      Ctrl-B Bold
      Ctrl-C Copy
      Ctrl-F Find
      Ctrl-G Goto
      Ctrl-H Find and Replace
      Ctrl-K Create Hyperlink
      Ctrl-N New (new Browser window, new Word document, etc.)
      Ctrl-O Open File
      Ctrl-P Print
      Ctrl-R Refresh
      Ctrl-S Save
      Ctrl-U Underline
      Ctrl-V Paste
      Ctrl-X Cut
      Ctrl-Z Undo
         
      Numeric Keypad * Expand branch of a tree view completely
      Numeric Keypad + Expand branch of a tree view (one level)
      Numeric Keypad - Collapse branch of a tree view

      Believe it or not, this list is far from complete.  Please feel free to mail me your favorite shortcuts.  I'll add them as time permits.  Contributors so far include:
                  Michael Stluka

      --Fred

    2. File Associations

      Last Updated: 11/3/2001
      Applies to:  Win95, Win98, WinMe, WinNT 4.0, Win2K, WinXP

      Ever wonder how Windows knows what program to open when you double-click on a filename that ends with ".doc"?

      Windows manages a set of "file associations" that associate filename extensions like ".doc" and ".txt" with programs like Word and Notepad.  One way to review and change the file associations on your computer is via Windows Explorer.  Explorer's menu tree is different in each version of Windows, but the capability is there in all versions.  In Win2K, go to:

          Windows Explorer | Tools | Folder Options... | File Types

      This opens a dialog box that shows the current "File Type" (for example, "Microsoft Word Document") associated with each extension (for example, "doc").  The buttons in the dialog box allow you to add, delete, and change file associations.

      You can't associate more than one file type with the double-click of a filename.  For example, double-clicking on a ".doc" file will always open Word or whatever other program you choose to associate with ".doc", but you can only have one such program associated with ".doc" at any time.  However, you can use the "Advanced" button to add additional action names and associate separate programs with each action.  For example, you could have Netscape Navigator as the default action for files ending in ".jpg", but create a separate "edit" action that invokes an image editor.  The default action is triggered by double-clicking on a file, but you can see it and all of the other available actions by right-clicking.

      See the tip "Open With" for an easier way to add associations.  

      See the tip "FTYPE and ASSOC" for a command-line way to view and manage associations.

      --Fred

    3. URL Associations

      Last Updated: 11/3/2001
      Applies to:  Win95, Win98, WinMe, WinNT 4.0, Win2K, WinXP

      In addition to "file associations" (programs associated with filename extensions -- like Word being associated with ".doc"), Windows manages "URL associations".  It associates a program with each URL protocol (each type of URL).  For example:

      • the "http:" URL protocol is associated with your Web Browser (Netscape Navigator, Microsoft Internet Explorer, etc.)
      • the "mailto:" URL protocol is associated with your mail program (Netscape Messenger, Lotus Notes, Eudora, Microsoft Outlook, etc.)
      • the "telnet:" URL protocol is associated with your telnet program (telnet, ktelnet, etc.)
      • the "ftp:" URL protocol is associated with your ftp program (ftp, cuteftp, etc.).

      Just as the file associations determine which program is invoked when you double-click on a file, the URL associations determine which program is invoked when you type a URL into your Web Browser, click on a link in your Web Browser, click on an "Internet Shortcut" on your Windows desktop, or in any other way "invoke" a URL.

      You can view and change the URL associations on your computer (just like the file associations) via Windows Explorer.  Explorer's menu tree is different in each version of Windows, but the capability is there in all versions.  In Win2K, go to:

          Windows Explorer | Tools | Folder Options... | File Types

      This opens a dialog box that shows the current file type associated with each extension.  Scroll down alphabetically to the letter N in the list of extensions.  There you'll find a bunch of entries with the extension "N/A" (not applicable) and file types like:

      • URL:HyperText Transfer Protocol
      • URL:MailTo Protocol
      • URL:Telnet Protocol
      • URL:File Transfer Protocol

      Edit these entries to control which program is invoked for each of these URL protocols.

      Thanks to Tom Stluka for helping me discover this!

      --Fred

    4. Open With

      Last Updated: 8/13/2000
      Applies to:  Win95, Win98, WinMe, WinNT 4.0, Win2K, WinXP

      Hold down Shift while right-clicking in Explorer and the menu gains an Open With entry that allows you to open a file with a different program from the one it is associated with.  Useful for things like opening a BAT file in Notepad instead of running it, opening a .C or .H file without firing up VC++, or opening a file that has no association. 

      Note:  The Open With dialog box also offers a "Always use this program to open this type of file" checkbox which is the easiest way to change the Windows "file association" for a specific type of file.  Thanks to Terry Walsh for reminding me of this!

      --Fred

    5. Add to the SendTo menu

      Last Updated: 11/9/2001
      Applies to:  Win95, Win98, WinMe, WinNT 4.0, Win2K, WinXP

      The SendTo menu of the right mouse menu in Windows Explorer is an alternative to "file associations" and "Open With".  File associations allow you to specify which program to run when you double-click a file, and additional programs to be shown in the right mouse click menu.  However, you have to tediously associate the programs with each individual file extension (".doc", ".txt", ".lis", etc.).  Too much work!  "Open With" is useful for a one-time exception, where you want to open a file with a different program than you usually use.  However, the list offered by "Open With" is long, full of programs you never use, and often missing the program you are looking for.  SendTo offers a useful alternative.  There is only one SendTo menu for each user on each computer -- not one per file extension.  Therefore, if you add your favorite programs (Notepad, WordPad, etc.) to the SendTo menu, they are available for all types of files.

      You can add to the SendTo menu by simply creating a shortcut to the desired program in the SendTo directory. On Win95/Win98/WinMe with no user profiles, add the shortcut to:

      	C:\Windows\SendTo

      On Win95/Win98/WinMe with user profiles, it is:

      	C:\Windows\Profiles\<username>\SendTo

      On WinNT 4.0, it is:

      	C:\WinNT\Profiles\<username>\SendTo

      On Win2K, it is:

      	C:\Documents and Settings\<username>\SendTo

      To add Notepad to the SendTo menu, right click on the Start menu, go to Programs, then Accessories, and right-drag the Notepad icon to the SendTo directory. When prompted, answer "Create shortcut".

      Similarly, you can delete or rename items in the SendTo menu by deleting or renaming them in this directory.

      To put the most useful items at the top of the SendTo menu, rename the shortcuts to names that come early in the alphabet.  Since the underline character comes before the letter A, I give my SendTo shortcuts names like "_Notepad", "_Wordpad", etc.

      --Fred

    6. Notepad as the default action for unknown file types

      Last Updated: 1/11/1999
      Applies to:  Win95, WinNT 4.0

      Here is a REG file that associates all file types with Notepad if they aren't explicitly associated with another program.  Then you can double click on such files to see them in Notepad.  Seems useful enough that I would have expected Microsoft to make it the default.

      	REGEDIT4
      	[HKEY_CLASSES_ROOT\Unknown\shell\Open\command]
      	@="notepad.exe %1"

      To apply this REG file, copy the four lines above (including the blank line) into a file like JUNK.REG, and type the command:

      	REGEDIT JUNK.REG

      Variations:

      1. For the command-line users out there, this also means you can type:
        	START file.ext

        for any filename file.ext with an obscure extension to open that file in NotePad.

      2. You can obviously do the same thing with your favorite editor instead of Notepad.
      3. I'm sure you can add other actions to the Unknown key, not just the default open action.  This would give you a more extensive right mouse menu for all such files.

      --Fred

    7. Bypass Recycle Bin

      Last Updated: 6/20/1999
      Applies to:  Win95, Win98, WinMe, WinNT 4.0, Win2K, WinXP

      Tired of deleting things into the Recycle Bin and then having to delete them again, from the Recycle Bin, to free up disk space?  Here's how to bypass the Recycle Bin so that delete really deletes.

      For one deletion:  Hold down Shift while deleting the file.  Notice the different prompt.  It asks if you really want to delete the file, not if you really want to move it to the Recycle Bin.

      For all deletions:  Right-click on the Recycle Bin icon and choose Properties.  Select the "Do Not Move Files To The Recycle Bin. Remove Files Immediately Upon Delete" checkbox.

      --Fred

    8. Startup Prompts

      Last Updated: 10/5/1999
      Applies to:  Win95, Win98, WinNT 4.0, Win2K, WinXP

      You probably know that you can get Windows to run a program automatically each time you login by adding it to your Startup folder, but what if you don't always want it to run?   I usually, but not always, want Lotus Notes to be launched when I login at my current client site.  Furthermore, their standard desktop setup has other things automatically running at startup that complain if Lotus Notes is already running.

      My solution is to add a new folder to the Startup folder, and put the Notes shortcut in that folder, not directly in the Startup folder.  At startup, Notes is not launched, but the nested folder is -- that is, it is opened as an Explorer window.  This window acts as a reminder to me to double-click on the Notes icon it contains in order to run Notes.  Thus, Notes is launched after all the other startup items, and is easy to bypass (simply don't double-click it).

      --Fred

    9. Windows Task Manager

      Last Updated: 10/5/1999
      Applies to:  WinNT 4.0, Win2K, WinXP

      The Windows Task Manager is a useful way to monitor, navigate to, and kill processes on your PC.  Run it by hitting Ctrl-Shift-Esc or by hitting Ctrl-Alt-Del and clicking Task Manager.  It has 3 tabs:

      The Applications tab shows all "applications" running on the PC.  This is roughly the same as the set of buttons in the Task Bar.  For each application, you can see its high level status:  "running", "not responding" (probably in a tight CPU loop where it is too busy to respond to Windows messages), etc.  (If you don't see the Status column, choose Details from the View menu.)

      If you need to close an application, and it won't close normally, try the End Task button here.  It tries to politely close the application, then waits a couple seconds, and if the application is not gone, it prompts you for whether to kill it more abruptly.

      The Processes tab shows much more detail.  It lists all processes on the PC, regardless of whether they have a user interface or whether they appear in the Task Bar.  This includes the "idle" process that runs continuously when the PC has nothing else to do.  By default this tab shows only the following columns:

      Image Name Name of the EXE file
      PID Process ID
      CPU Current percent of CPU usage
      CPU Time Total CPU time hh:mm:ss used by the process so far
      Mem Usage Amount of memory being used

      However, you can select the Processes tab, then choose Select Columns from the View menu, to select the following additional columns:

      Mem Delta Change in memory usage since previous refresh
      Page Faults Total page faults of the process so far
      PF Delta Change in number of page faults since previous refresh
      VM Size Virtual Memory size
      Paged Pool Size of memory in the Paged Pool
      NP Pool Size of memory in the Non-Paged Pool
      Base Pri Base Priority (I wonder why not Dynamic Priority also?)
      Handles Number of Handles
      Threads Number of Threads

      Click on any of the column headers to sort by that column.  Click again to sort in reverse order.   This is a handy way to see which process has the highest current CPU usage, or the highest current rate of page faults, etc.

      Click on the End Process button to abruptly kill a process.  If the process is one of the applications, this is the same as the abrupt kill described above.

      The Performance tab gives a good overview of the entire system:   histograms of total CPU usage and total memory usage; total number of handles, threads and processes; amount of physical and available memory, etc.

      Also, whenever it is running, the Task Manager maintains in icon in the System Tray (right hand end of the Task Bar) that shows the current CPU usage.  For a continuously updated CPU meter that consumes very little screen space, choose Hide When Minimized from the Options menu, and then minimize the Task Manager.  It shows the icon in the system tray, but doesn't show a button in the Task Bar.  In addition to the dynamic icon showing CPU usage, you can see the exact percent of CPU usage by hovering the mouse over that icon.

      OK, this was a longer tip than usual.  Did I miss anything?

      --Fred

    10. Startup Locations

      Original Version: 5/7/1998
      Last Updated: 2/17/2008
      Applies to:  Win95, Win98, WinNT 4.0, WinMe, Win2K, WinXP

      Ever wonder why a certain program starts every time you boot your PC?  Or why an icon shows up in your system tray?  You look in the Startup folder but nothing is there.  Here's a list of places to check:

      1. Windows Startup folder:

        Typically stored in one of the following places: 
            C:\Windows\Start Menu\Programs\Startup
            C:\Windows\<username>\Start Menu\Programs\Startup
            C:\Windows\Profiles\<username>\Start Menu\Programs\Startup
            C:\Documents and Settings\<username>\Start Menu\Programs\Startup

      2. Windows Startup folder for All Users:

        Typically stored in one of the following places: 
            C:\Windows\Start Menu\Programs\Startup
            C:\Windows\All Users\Start Menu\Programs\Startup
            C:\Windows\Profiles\All Users\Start Menu\Programs\Startup
            C:\Documents and Settings\All Users\Start Menu\Programs\Startup

      3. Windows Registry:

        There are several registry locations where various versions of Windows check for programs to be automatically started.  They have names like:

        HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows\load
        HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows\run

        HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
        HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce
        HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnceEx
        HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunServices
        HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunServicesOnce

        HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Windows\load
        HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Windows\run

        HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
        HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce
        HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnceEx
        HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices
        HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServicesOnce

      4. INI Files

        Older versions of Windows look in the following INI files:

        C:\Windows\WIN.INI
        [Windows]
        Load=xxx
        Run=xxx

        C:\Windows\SYSTEM.INI
        [Boot]
        Shell=xx

      5. Windows NT Services

        Windows NT services can be configured to start automatically.  Check: 
        Start Menu | Control Panel | Services

      6. C:\AUTOEXEC.BAT and C:\CONFIG.SYS

        Don't forget these old standbys.  DOS isn't that dead yet...

      In some versions of Windows, there is a tool to help you check and edit all of these locations.  In Windows 95, 98, ME, and XP, it is called:
          msconfig.exe
      If it is not found automatically when you type:
          msconfig
      at the Windows command line, search for it via the command:
          dir /s /a msconfig.*
      and run it by typing its full name and location at the command line.  Alternatively, search for it via the Windows Explorer search capability and double click on it when found.

      Be careful about deleting startup items from any of these locations.  Some items that you may not be aware of are required or very useful.  For example, you probably don't want to delete the registry entries that start your Virus Scan software, or stop the NT services that are needed by your Zip drive.

      Here is a link to a list of Web sites to learn about a specific item before deleting it:

          http://bristle.com/~fred/#windows_startup

      Thanks to Jeff Stluka for telling me about some of these Web sites.

      --Fred

    11. Show window contents while dragging

      Original Version:  12/16/1998
      Last Updated: 1/10/2007
      Applies to:  WinNT 4.0, Win2K, WinXP

      By default, when you drag a window on the Windows NT desktop, only the outline of the window is dragged.  When you release, the contents of the window are redrawn in the new location.  To change this behavior, so that the contents of the window are continuously redrawn as you drag, open Control Panel, select the Display applet, then the Plus! tab, and the Show window contents while dragging option.

      In Windows 2000, the default has been changed to show the contents when dragging.  To see the outline only, open Control Panel, select the Display applet, then the Effects tab, and turn off the Show window contents while dragging option.  This is sometimes useful for fine-tuning the position of a window since you can see new and old positions at the same time.

      --Fred

  3. Start Menu Tips

    1. Add to Start Menu

      Last Updated: 12/1/1998
      Applies to:  Win95, Win98, WinMe, WinNT 4.0, Win2K, WinXP

      To add more items to the top level of the Start Menu, simply drag them there from Explorer or from the desktop, dropping them on the Start button that is used to pop up the Start Menu.

      --Fred

    2. Add Desktop to Start Menu

      Original Version: 11/25/2001
      Last Updated: 6/6/2008
      Applies to:  Win95, WinNT 4.0, not Win2K, not WinXP

      One very useful item to add to the Start menu is the desktop itself.  Then when you have a very cluttered screen, you don't have to close, move, or minimize a bunch of windows to find that incredibly useful shortcut icon that you keep on your desktop.  Instead, pop up the Start Menu, select the Desktop icon, and use your shortcut icon, without disturbing your real desktop.

      To add the desktop to your Start Menu, create a shortcut (right click on the desktop and select New | Shortcut) with the properties:

      	Command Line:	Explorer /root,
      	Name:		Desktop

      Be sure to leave the trailing comma on the command line.  This creates a shortcut to the desktop.  Then drag that shortcut to the Start Menu as shown in Add to Start Menu.

      Note:  You can also use the right mouse button to Open the Start menu (as described in Delete from Start Menu) and then use the right mouse button to drag the desktop icon from \WinNT\Profiles\<user>\ (or \Windows\Profiles\<user>\ for Win95) to the window showing the Start menu icons).  If you create a shortcut, you get exactly the effect described above.  If you create a copy, the menu entry you create pops out a submenu of the desktop instead of showing the desktop as an Explorer window.  The downside to creating a copy is that it is a copy of the desktop at that point in time.  Any future changes to the desktop are not reflected in the popout submenu, unless you redo the copy operation.

      Note:  This does not work on Win2K or WinXP.  Anyone know how to fix that?

      --Fred

    3. Delete from Start Menu

      Last Updated: 12/5/1998
      Applies to:  Win95, Win98, WinMe, WinNT 4.0, Win2K

      To delete items from the Start Menu, or edit the Start Menu in general, right click the Start button and select Open from the popup menu.  This opens the Start Menu as a folder in Windows Explorer.  Then you can add or delete icons, right click them to change their properties, and even define new folders that become submenus of the Start Menu.

      --Fred

    4. Small icons in Start Menu

      Last Updated: 12/16/1998
      Applies to:  Win95, Win98, WinMe, WinNT 4.0, Win2K, WinXP

      If your Start Menu is getting too crowded, you can save some space by selecting the small icons option.  Right click the task bar and select Properties.  Choose Show small icons in Start menu.

      Note:  This has the side effect of removing the banner up the side of the Start Menu that says "Windows 95", "Windows NT", etc.

      --Fred

  4. Command Line / GUI Integration

    1. CMD Here

      Last Updated: 1/17/1999
      Applies to:  Win95, Win98, WinMe, WinNT 4.0, Win2K, WinXP

      Want a way to open a new command line window in a specific directory after navigating to that directory in Windows Explorer?  The MS DOS Here Power Toy offers a way to do this, but I prefer a simpler, more controlled and flexible approach.

      You can add a CMD Here entry to the right mouse menu for folders in Explorer.  Start from the View menu of Explorer:

      	Explorer | View | Options | File Types | Folder | Edit | New...
      	- Action = CMD Here
      	- Application = cmd.exe		(On WinNT)
      	- Application = command.com	(On Win95)

      If you want the command line window to run a batch file as it opens (to set environment variables, set the prompt, run DOSKEY, etc.), use the /k option, as:

      	Explorer | View | Options | File Types | Folder | Edit | New...
      	- Action = CMD Here
      	- Application = cmd.exe	/k c:\myfile.bat	(On WinNT)
      	- Application = command.com /k c:\myfile.bat	(On Win95)

      --Fred

    2. Command Line Copy and Paste

      Last Updated: 5/9/1999
      Applies to:  Win95, Win98, WinMe, WinNT 4.0, Win2K, WinXP

      To copy text from a command line window to the Windows clipboard, use the system menu of the Command Prompt window. 

      With the mouse:

      1. Click on the box at the top left corner of the window to display the system menu.
      2. Choose Edit.
      3. Choose Mark.
      4. Drag the mouse to select the desired text.
      5. Click on the box at the top left corner of the window to display the system menu again.
      6. Choose Edit.
      7. Choose Copy.

      With the keyboard (Hey, we are at a command line after all, right?):

      1. Type Alt and Space together to display the system menu.
      2. Type e for Edit.
      3. Type k for Mark.
      4. Use the mouse or arrow keys to move to the start of the desired text and mouse or shift-arrows to select the text.
      5. Hit the Return key to copy.

      Paste is similar, except choose Paste instead of Mark and Copy.  From the keyboard, it's Alt+Space,E,P

      --Fred

    3. Drag to Command Line

      Original Version: 5/9/1999
      Last Updated: 10/30/2008
      Applies to:  Win95, Win98, WinMe, WinNT 4.0, Win2K, WinXP

      Tired of typing out long paths for filenames?  Want a quick way to get the full path of a file as a string?  Drag the file from Explorer to a Command Line window.   The full path of the file is typed out on the command line waiting for you to copy/paste into some other application, or to edit into a command and hit return.

      Note:  According to the 10/9/2008 edition of the Windows Secrets newsletter, this feature was deliberately removed by Microsoft in Vista, for security reasons.  You can still drag to the Windows Run box of the Start menu.  Or you can Shift-Right-Click a folder and choose "Copy as Path" to copy the full path to Windows clipboard, so you can then paste it elsewhere.

      --Fred

  5. Command Line Tips

    1. Command Line Editing

      Original Version: 10/3/1999
      Last Updated: 1/10/2007
      Applies to:  WinNT 4.0, Win2K, WinXP

      At the Windows command line, you can use the up and down arrow keys to scroll through the list of previously entered commands and select one for re-execution.  Once you've selected one, you can use the left and right arrow keys to move around in the command making changes before re-executing it.  You can also use the Insert key to toggle between insert and overstrike modes.  After typing part of a recently entered command, hit F8 to automatically fill in the rest of the command.  Keep hitting F8 to see additional recent matches.  Use F7 to see a popup menu of recent commands to choose from.  Use the command:

      	DOSKEY /INSERT

      to change the default mode from overstrike to insert

      Here is a summary, along with some other less useful keys, probably included primarily for compatibility with earlier versions of DOS, Windows, DOSKEYS, etc:

          F1   Show one more char of the previous command
          F2   Prompt for char of previous command to show to
          F3   Show the rest of the chars of the previous command
          F4   Prompt for char of previous command to delete to
          F7   Popup menu of recent commands
          F8   Cycle through recent commands with specified prefix
          F9   Prompt for number of previous command to recall

      For more info, type:

      	HELP DOSKEY

      Most of the above is also true for the command line of Win95, Win98, and WinMe.

      --Fred

    2. Command Line Completion

      Original Version:  5/9/1999
      Last Updated:  1/10/2007
      Applies to:  WinNT 4.0, Win2K, WinXP

      You can configure WinNT, Win2K, and WinXP (sorry, not Win95, Win98, WinMe) so that when you press the TAB key it completes the file name you are typing at a command prompt.  Unix and Emacs users will recognize this feature from many years ago.  Use REGEDIT to edit:

      	HKEY_CURRENT_USER/Software/Microsoft/Command Processor

      Double Click on CompletionChar or add a value of type REG_DWORD, and set it to value 9.
      Any command windows opened from then on support the use of Tab as a completion char. Tab cycles through all filenames that match what you've typed so far, and Shift-Tab cycles backwards through the filenames.

      --Fred

    3. PUSHD, POPD, CD /D, CD abc*

      Original Version: 1/25/2002
      Last Updated: 6/6/2008
      Applies to:  WinNT 4.0, Win2K, WinXP

      Want an easy way to return to a directory that you just left?  NT-based versions of Windows (WinNT 4.0, Win2K, etc) add some Unix-like capabilities for navigating directories.  The PUSHD and POPD commands manage a stack of directories.  PUSHD moves to a new directory like CD does, but also pushes the current directory on a stack.   POPD pops the current directory off of the stack and returns to it.  PUSHD with no parameters shows the stack, like the Unix dirs command.

      Aside from being handy when you need to move to a directory temporarily during an interactive session, this can be very useful in a batch file.  Some commands require that a specific directory be the working directory when they are executed.  To run them from a batch file, you have to change the current working directory to the required one.  However, this has a persistent effect on the user of the batch file.  If you change with PUSHD instead of CD, you can return with POPD at the end of the batch file, leaving the user's working directory unchanged.

      Also, like the Unix versions, CD, PUSHD, and POPD now take wildcards, so you can type CD abc* to move to a directory name that starts with "abc". 

      Also, PUSHD and POPD both act like CD /D not just plain CD -- that is, they will change to a new drive letter as well as a new directory, if you specify one.

      If only they'd add the Unix concept of "cdpath"...  But that's pretty easy to do yourself with a batch file.  I call mine c.bat.  Let me know if you want details.

      --Fred

    4. START a File

      Last Updated: 11/3/2001
      Applies to:  Win95, Win98, WinMe, WinNT 4.0, Win2K, WinXP

      Want a way to use Windows "file associations" from the command line or in a batch file?

      Use the start command to launch the associated program for a file.  For example:

          start Document1.doc

      launches Microsoft Word, if that is the program associated with ".doc" files on your computer.

      On WinNT4, Win2K and WinXP, the word "start" is even optional.  You can simply type:

          Document1.doc

      For more info, type:

          help start   

      --Fred

    5. START a URL

      Last Updated: 12/8/2002
      Applies to:  Win95, Win98, WinMe, WinNT 4.0, Win2K, WinXP

      Want a way to use Windows "URL associations" from the command line or in a batch file?

      Use the start command to launch the associated program for a URL.  For example:

          start mailto:tips@bristle.com

      launches your mail program (Netscape Messenger, Lotus Notes, Eudora, Microsoft Outlook, etc.) and fills in my e-mail address in a blank message.  All you have to do is type in the rest of the message and hit Send.  Similarly, you can browse to a Web page via:

          start http://bristle.com

      Unlike "file associations", even on WinNT4 and Win2K, the word "start" is not optional.  You cannot simply type:

          mailto:tips@bristle.com	(Doesn't work)
          http://bristle.com		(Doesn't work)

      For more info, type:

          help start   

      --Fred

    6. FTYPE and ASSOC

      Last Updated: 11/3/2001
      Applies to:  WinNT 4.0, Win2K, WinXP

      Want a way to define Windows "file associations" from the command line or in a batch file?

      The Problem:

      I find the Windows Explorer interface for file associations very tedious.  You typically start out either knowing that you want to associate a program with a specific filename extension (like .jpg, for example), or wondering what program is associated with such an extension.  Perhaps you remember that tip somebody sent you once about Shift-RightClick.   So you find a .jpg file in Explorer, hold down Shift, right-click the file, and choose Open With.  This displays the Open With dialog box that allows you to scroll through a long but incomplete list of application names, failing to find the one you are looking for.  Wonderful!  Now what?

      Next, you click Explorer | View | Options... | File Types to see a list of "registered file types" that have no discernible relationship to the filename extension you have in mind.  You browse through this list, watching the "File type details" frame to find the one, if any, that lists .jpg, along with a whole bunch of other extensions (.jpe, .jpeg, etc.).  If you want to change the association, you then click the Edit... button and spend several minutes coming to the conclusion that there is no easy way to change the association for .jpg without also changing it for .jpe and .jpeg.  You find yourself thinking fondly of the "good old days" of Windows 3.1...

      The Solution:

      Use the assoc command to see what "file type" (a string almost but not quite entirely unrelated to the "registered file types" shown by Explorer") is associated with the extension .jpg:

          assoc .jpg

      The output is a line like:

          .jpg=ImageComposer.jpg

      Next, use the ftype command to see what application is associated with the file type "ImageComposer.jpg":

          ftype ImageComposer.jpg

      The output is a line like:

          imagecomposer.jpg=E:\ImagComp.15\imgcomp.exe "%1"

      If you want to change or create the file association for .jpg use commands like:

          assoc .jpg=jpgfile
          ftype jpgfile=E:\Netscape\Commcatr.472\Program\netscape.exe "%1"

      where "jpgfile" is any descriptive string you choose to use as a "file type".

      For more info, type:

          help assoc
          help ftype

      There is also a tool in the Windows resource kit called associate that combines assoc and ftype.   

      --Fred

    7. Command Line Redirection

      Last Updated: 3/15/2002
      Applies to:  Win95, Win98, WinNT 4.0, WinMe, Win2K, WinXP

      The command lines in various versions of Windows support some of the Unix-style forms of file redirection and command substitution.  For details, see:

          Unix.htm#general_command_line_redirection

      --Fred

    8. XCOPY /M and /A burn out USB flash drives

      Last Updated: 11/12/2008
      Applies to:  Win3.x, Win95, Win98, WinNT 3.51, WinNT 4.0, WinMe, Win2K, WinXP

      Warning:  The Windows commands XCOPY /M and XCOPY /A burn out USB flash drives.

      I've used XCOPY with the /M or /A option from the Windows command line for years, as a very convenient way to do incremental backups.  However, it is extraordinarily inefficient and was regularly burning out USB flash drives until I made a change.

      Details:

      XCOPY /S /M walks the directory tree, finding modified files, and copying them to the target tree.  Unfortunately, it uses a very inefficient algorithm that can lead to a huge number of writes to the target tree, which seems to burn out USB flash drives very quickly.

      I assumed it would first find a modified file, then create the nested target directories if necessary, then copy the file.  Instead, it walks the entire source tree, creating each target directory, then checking to see whether there are any modified files in that directory, then deleting the target directory if it was not needed.  Since I use XCOPY /S /M at least once per day to do an incremental backup of my entire massive directory tree onto an empty directory tree on the target device, this involves thousands of directory creations and deletions on the target device in order to back up a handful of modified files.  

      I first noticed the problem years ago, when it took FOREVER to backup a couple of modified files to floppy disk.  While it churned, I browsed the directory structure of the floppy, where directories were coming and going like crazy.  Very inefficient, but eventually it produced the right result, so I couldn't really say it was a bug.  It put the modified files on a floppy, and from there, I could copy them to another computer for backup purposes.

      Then I moved to Iomega Zip drives and it got so much faster that it was OK for a couple years.  Also, since the Zip drives could hold so much more than a floppy, I started doing my incremental backups into a fully populated target tree instead of an empty tree.  Most of the directories already existed there, so XCOPY /M did few creations and no deletions.  I no longer needed to copy the files from the Zip drive to another computer for backup, since the Zip drive could hold a complete set of files itself.

      Then I moved to USB flash drives, which held even more than Zip drives.  Since they had so much space, I continued keeping a full copy of all my files there, but also resumed my practice of doing daily incremental backups into empty directory trees so that I could have each day's version of a file, not just the latest version.  Since the flash drive was so fast, the massive number of directory creations and deletions was not a big issue.

      After a couple months, my USB flash drive suddenly failed.  I could no longer read or write any files or even see the directory tree.  I bought a new USB flash drive.  It failed a few months later.  I bought another.  It failed soon also.  No one else was reporting that USB flash drives were so bad, so I got curious.

      I discovered that XCOPY /M was the culprit.  So, I re-wrote my backup batch file to do an XCOPY /S /M to a staging area on the hard drive, immediately followed by an XCOPY /S (no /M) from there to the USB drive, followed by deleting the staged tree.  No more USB flash drive problems!  However, I'm now doing an awful lot of writes to my regular hard drive, so I hope it can handle it!

      I still recommend XCOPY /S /M as an easy way to do incremental backups, just not to an empty directory tree.  If you do it to a fully populated backup tree, it works fine.  The exact command I use is:

          XCOPY /M /S /E /Y /I /F /H /K /R /V

      See XCOPY /? or HELP XCOPY for details of these options.

      If you start using XCOPY /M for backups, or even if you use any other incremental backup mechanism, you may want to know more about the "archive" bit that is used by all such mechanisms.  Whenever you modify a file, Windows automatically sets the archive bit to indicate that the file should be archived (backed up).  Incremental backup techniques typically backup all files that have the archive bit set, clearing the archive bit on each file as it is backed up.

      Therefore, you should know the following:

      1. XCOPY /M clears the archive bit of each file that it successfully copies.  This means that:

        1. Doing an XCOPY /M to backup modified files will probably cause any other incremental backup mechanism that you or your employer may also use to skip those files.
        2. Conversely, doing an incremental backup by any other mechanism will probably cause XCOPY /M to skip those files.
        3. It is safe to do an XCOPY /M to a small or nearly full device.  It keeps copying files until it runs out of space.  Then it fails, reports an error message, deletes the partially copied target file, and does NOT clear the archive bit on the source file.  If you then issue the same XCOPY /M command to a different device, or after inserting a new floppy or Zip disk, it ignores all of the successfully copied files, and resumes copying the rest of the files.  You can use this technique to copy a large set of files to multiple disks if they won't all fit on one, as long as no one file is bigger than an entire disk.

      2. XCOPY /A behaves identically to XCOPY /M, except that it does NOT clear the archive bit on each file after copying the file.  Therefore, XCOPY /A is useful as a way to do the same incremental backup to multiple target directory trees.  Use XCOPY /M when copying to the last target, but XCOPY /A for all the previous targets.  XCOPY /A is also useful as a way to do your own incremental backups without interfering with any other incremental backup mechanisms.

      3. The command DIR /S /AA can be used to see a list of files that have the archive bits set, and their total size, to know which files would be backed up by XCOPY /M (or /A), and how much space they'll require.  Similarly, DIR /S /A:-A shows files that do NOT have the archive bit set.

      4. The command ATTRIB -A can be used to clear the archive bits of one or more files to prevent them from being backed up.  Or ATTRIB +A to set the archive bits to cause unmodified files to be backed up by the next incremental backup.  Both commands allow wildcards, and also support a /S option to handle matching filenames in entire directory trees.

      5. You can direct Windows Explorer (My Computer) to show you the archive bits.  From the View menu, go to Choose Details... and select Attributes.  It will show an additional column that contains an "A" if the archive bit is set.

      6. You can set and clear the archive bit of individual files from Windows Explorer (My Computer) by right-clicking on a file and choosing Properties.  On newer versions of Windows, you may then have to click an Advanced... button to see it.

      --Fred

    9. See Also

      Last Updated: 12/22/2000
      Applies to:  WinNT 4.0, Win2K, WinXP

      The following are good sources of info about the WinNT command line:

      1. http://www.linuxworld.com/linuxworld/lw-1999-04/lw-04-thereandback_p.html
        Comparison of Windows NT and Unix command lines

      --Fred

  6. Batch File Tips

    1. Command Extensions

      Last Updated: 12/27/1998
      Applies to:  WinNT 4.0, Win2K, WinXP

      The "Command Extensions" of WinNT 4.0 add lots of additional functionality to the commands used in a batch file.  Unix users will find much of the functionality familiar -- things available in Unix via the find command, backtick operators, etc.  WinNT Command Extensions are enabled by default, and can be explicitly enabled by the /X option of CMD.EXE.   The following commands are added or enhanced:

      	DEL/ERASE
      	COLOR
      	CD/CHDIR
      	MD/MKDIR
      	PROMPT
      	PUSHD
      	POPD
      	SET
      	SETLOCAL
      	ENDLOCAL
      	IF
      	FOR
      	CALL
      	SHIFT
      	GOTO
      	START
      	ASSOC
      	FTYPE

      For more info, type:

      	HELP CMD

      at the command line.

      --Fred

    2. Pre-defined variables

      Last Updated: 2/3/2005
      Applies to:  Win2K, WinXP

      With Command Extensions enabled, there are several pre-defined environment variables:

      Variable Meaning
      %CD% Current directory
      %DATE% Current date
      %TIME% Current time
      %RANDOM% Random number 0-32767
      %ERRORLEVEL% Current ERRORLEVEL value
      %CMDEXTVERSION% Command Extensions version number
      %CMDCMDLINE% Original command line that invoked the Command Processor.

      For more info, type:

      	HELP SET

      at the command line, or see the references in the See Also tip.

      --Fred

    3. Parsing strings

      Last Updated: 2/3/2005
      Applies to:  WinNT 4.0, Win2K, WinXP

      With Command Extensions enabled, the syntax for the evaluation of variables is significantly extended.  In addition to the familiar syntax:

      	%variable%

      you can use the following forms:

      Syntax Examples
      %var1:str1=str2% Returns a value with each occurrence of str1 in var1 replaced with str2.
      str1
      can start with an asterisk.
      str2 can be empty.
      %var1:abc=def% Returns a value with each occurrence of "abc" in var1 replaced with "def"
      %var1:*abc=def% Returns a value with the first occurrence of "abc" in var1, and everything that precedes it in var1, replaced with "def"
      %var1:abc=% Returns a value with each occurrence of "abc" in var1 deleted (replaced with the empty string)
      %var1:~n,m% Extracts a substring from var1 starting at position n (0-based) for length m.
      Length m can be omitted.
      Negative n or m counts from the end.
      %var1:~3,5% Extracts the 4th through 8th characters from var1
      %var1:~3% Extracts the 4th through last characters of var1
      %var1:~-9,5% Extracts the 5 chars starting with the 9th from the end of var1
      %var1:~0,-5% Extracts all except the last 5 chars of var1

      For more info, type:

      	HELP SET

      at the command line, or see the references in the See Also tip.

      --Fred

    4. SET command

      1. SET /A - Arithmetic, bitwise, and logical operators

        Last Updated: 12/27/1998
        Applies to:  WinNT 4.0, Win2K, WinXP

        With Command Extensions enabled, the SET command has a much more useful syntax.  In addition to the familiar syntax:

        	SET X=Y

        you can use the /A option to do arithmetic, logical operations, bitwise shifts, etc., like the following:

        	SET /A X = "(7 * (Y + Z) / 2 << A) & 0x0FFF + 077"

        The complete list of operators, in order of precedence, is:

        () grouping
        * / % multiplicative operators
        + - additive operators
        << >> logical shift
        & bitwise and
        ^ bitwise exclusive or
        | bitwise or
        = *= /= %= += -= &= ^= |= <<= >>= assignment
        , expression separator

        For more info, type:

        	HELP SET

        at the command line, or see the references in the See Also tip.

        --Fred

      2. SET /P - Prompting the user for input

        Last Updated: 2/3/2005
        Applies to:  Win2K, WinXP

        With Command Extensions enabled, the SET command supports a /P option which prompts the user for input.  For example:

        	SET /P X=Enter a value: 

        prompts the user with the specified string and stores the user's line of text as the value of X.

        For more info, type:

        	HELP SET

        at the command line, or see the references in the See Also tip.

        --Fred

    5. FOR command

      1. Expanding wildcards

        Last Updated: 1/10/1999
        Applies to:  DOS, Win 3.1, Win95, WinNT 3.51, WinNT 4.0, Win2K, WinXP

        Even without WinNT Command Extensions enabled, the FOR command can be used to expand wildcards.  For example, Notepad does not take a wildcarded parameter, so you cannot load all *.TXT files into Notepad with the command:

        	notepad *.txt

        However, you can expand the wildcard with the FOR command, and accomplish the same thing, as:

        	for %i in (*.txt) do start notepad %i

        This is too long and clunky to be useful, so I created a batch file called N.BAT containing the single line:

        	for %%i in (%1 %2 %3 %4 %5 %6 %7 %8 %9) do start notepad %%i

        Now I can just type:

        	n *.txt

        --Fred

      2. Expanding wildcards to match directory names

        Last Updated: 1/10/1999
        Applies to:  WinNT 4.0, Win2K, WinXP

        With Command Extensions enabled, the syntax of the FOR command is significantly extended.  In addition to the familiar syntax:

        	FOR %i IN (*.*) DO command [params]

        you can use the /D (directory) option to cause wildcards to match directory names instead of filenames.  Thus, a command like:

        	FOR /D %i IN (*.*) DO ECHO %i

        echoes the names of all subdirectories of the current directory.  For more info, type:

        	HELP FOR

        at the command line, or see the references in the See Also tip.

        --Fred

      3. Recurring over a directory tree

        Last Updated: 1/10/1999
        Applies to:  WinNT 4.0, Win2K, WinXP

        Another extension to the FOR command when Command Extensions are enabled is the /R (recursive) option which causes the FOR command to match files (or directories if /D is also used) in subdirectories, not only the current directory.  Thus, the N.BAT file in tip Expanding wildcards can be enhanced to have its own /R option as:

        	rem Check for /R option.
        	if "%1" == "/R" goto RECURSIVE
        	if "%1" == "/r" goto RECURSIVE
        
        	rem Normal processing
        	for %%i in (%1 %2 %3 %4 %5 %6 %7 %8 %9) do start notepad %%i
        	goto EXIT
        
        	:RECURSIVE
        	if not "%OS%" == "Windows_NT" goto NOT_NT
        	shift
        	for /r %%i in (%1 %2 %3 %4 %5 %6 %7 %8 %9) do start notepad %%i
        	goto EXIT
        
        	:NOT_NT
        	echo Error:  /r option is only valid on Windows NT.
        	goto EXIT
        
        	:USAGE
        	echo Usage: %0 [/r] filename...
        	goto EXIT
        
        	:EXIT

        Now the command:

        	n /r *.txt

        opens all *.txt files in the current directory and in all subdirectories.  For more info, type:

        	HELP FOR

        at the command line, or see the references in the See Also tip.

        --Fred

      4. Looping a specified number of times

        Last Updated: 1/10/1999
        Applies to:  DOS, Win 3.1, Win95, WinNT 3.51+, WinNT 4.0, Win2K, WinXP

        Even without WinNT Command Extensions enabled, the FOR command can be used to loop a specific number of times, but it is kind of clunky.   The line:

        	FOR %i IN (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15) DO command

        executes the specified command 15 times.

        --Fred

      5. Looping a specified number of times more easily

        Last Updated: 9/26/2001
        Applies to:  WinNT 4.0, Win2K, WinXP

        With WinNT Command Extensions enabled, the FOR command takes a new /L (loop) option.  The syntax is:

        	FOR /L %i IN (start,step,end) DO command [params]

        Using this syntax, the loop shown in Looping a specified number of times can be re-written as:

        	FOR /L %i IN (1,1,15) DO command

        to execute the specified command 15 times.  For more info, type:

        	HELP FOR

        at the command line, or see the references in the See Also tip.

        --Fred

      6. Reading from a file

        Last Updated: 1/10/1999
        Applies to:  WinNT 4.0, Win2K, WinXP

        With WinNT Command Extensions enabled, the FOR command takes a new /F (file) option which can be used to read from a file.  The syntax is:

        	FOR /F ["options"] %i IN (filenames) DO command [params]

        With no options specified, this reads each line from each of the specified files, and uses the first space-delimited token as the value of %i.  Thus, the command:

        	FOR /F %i IN (file1.txt file2.txt) DO echo %i

        echoes the first space-delimited token from each of the lines of each of the files file1.txt and file2.txt.  The following options can be specified to control how the lines of the files are parsed, overriding the default behavior of extracting the first space-delimited token:

        Option Example
        eol=c Specifies an end of line comment character eol=; A semicolon (;) in any line causes the rest of that line to be ignored.
        skip=n Specifies the number of lines to skip at the beginning of the file. skip=5 Skip the first 5 lines of each file.
        delims=xxx Specifies a delimiter set. delims=,.: The comma (,), period (.), and colon (:) chars serve as token delimiters instead of blank and tab.
        tokens=x,y,m-n Specifies which tokens from each line are to be passed to the for body for each iteration. This will cause additional variable names to be allocated. The m-n form is a range, specifying the mth through the nth tokens. If the last character in the tokens= string is an asterisk, then an additional variable is allocated and receives the remaining text on the line after the last token parsed.  
        Default is tokens=1.
        tokens=2,4,6-9,11* If the loop counter was called %i, the 2nd token is assigned to %i, the 4th token to %j, the 6th token to %k, the 7th token to %l, the 8th token to %m, the 9th token to %n, the 11th token to %o, and the remainder of the line to %p.

        For more info, type:

        	HELP FOR

        at the command line, or see the references in the See Also tip.

        --Fred

      7. Reading from a string

        Last Updated: 1/10/1999
        Applies to:  WinNT 4.0, Win2K, WinXP

        With WinNT Command Extensions enabled, the /F option of the FOR command can also be used to read from a literal string.   The syntax is:

        	FOR /F ["options"] %i IN ("string") DO command [params]

        Note the use of double quote chars to delimit the literal string.  This behaves exactly like the FOR /F command described in Reading from a file, except that the specified string is processed instead of lines from the specified files.  For more info, type:

        	HELP FOR

        at the command line, or see the references in the See Also tip.

        --Fred

      8. Parsing the output of a command

        Last Updated: 1/24/1999
        Applies to:  WinNT 4.0, Win2K, WinXP

        With WinNT Command Extensions enabled, the /F option of the FOR command can also be used to invoke another command, and trap and parse its output.   The syntax is:

        	FOR /F ["options"] %i IN ('command1') DO command2 [params]

        Note the use of single quote chars to delimit the nested command.  This behaves exactly like the FOR /F command described in Reading from a file, except that the specified command is executed by a child CMD.EXE, and its output is captured and used as the file to be parsed.   (Unix users will recognize this as exactly the behavior of the backtick operator in the Unix command line, except that here the regular single quote is used instead of the backtick, and it only works in the context of a FOR loop.)   For more info, type:

        	HELP FOR

        at the command line, or see the references in the See Also tip.

        --Fred

      9. EXEC.BAT: Executing any command on any set of files

        Last Updated: 1/1/2007
        Applies to:  WinNT 4.0, Win2K, WinXP

        With WinNT Command Extensions enabled, the /F option of the FOR command can be used to write a batch file that behaves like the find -exec command of Unix -- it executes the specified command against each of the files found by the specified DIR command.  See the EXEC.BAT file below:

        @echo off
        rem -------------------------------------------------------------------------
        rem Batch file to execute a command on a set of files.
        rem -------------------------------------------------------------------------
        rem Revision History:
        rem     6/5/1982        Fred Stluka
        rem     - Initial version for IBM VMS/CMS (FILELIST EXEC)
        rem     10/12/1985      Fred Stluka
        rem     - Initial version for DEC VAX/VMS
        rem     10/4/1988       Fred Stluka
        rem     - Initial version for Unix (find -exec, find -ok)
        rem     12/2/1998       Fred Stluka
        rem     - Initial version for Windows NT
        rem     2/3/2005        Fred Stluka
        rem     - Execute command via "call" in case it's a BAT file.
        rem     - Expand filenames to fully qualified paths via ~f.
        rem     - Notes explaining FOR command syntax.
        rem     $Log$
        rem -------------------------------------------------------------------------
        
        rem Turn echo back on if ECHO environment variable equals ON.
        if not "%ECHO%"=="" echo %ECHO%
        
        if "%1" == "" goto USAGE
        if "%1" == "-?" goto USAGE
        if "%1" == "/?" goto USAGE
        if not "%OS%" == "Windows_NT" goto NOT_NT
        
        rem Accumulate the DIR options and file specs (everything until "DO").
        set DIR_PARAMS=
        :GET_DIR_PARAMS
        for %%i in (do DO dO Do) do if "%1"=="%%i" goto DO_FOUND
           if "%1"=="" goto NO_DO_FOUND
              set DIR_PARAMS=%DIR_PARAMS% %1
              shift
              goto GET_DIR_PARAMS
        :DO_FOUND
        shift
        
        rem Run the command on the files.
        rem
        rem Notes:
        rem - The /f switch causes FOR to parse each line in a file.
        rem - The "tokens=*" option causes an entire line of the file to be handled
        rem   at once.  (Required, since default is first token only.)
        rem - Percent signs must be doubled on FOR loop variables inside BAT files.
        rem - The apostrophes cause the DIR command to be evaluated to produce the 
        rem   "file" to be parsed by /f.
        rem - The ~f modifier expands the filename in %i to a fully qualified path.
        rem - For more info, type:  HELP FOR
        rem
        echo DIR parameters: %DIR_PARAMS%
        echo Files to be processed:
        for /f "tokens=*" %%i in ('dir %DIR_PARAMS% /a-d /b') do echo "%%~fi"
        rem Note:  "echo." echoes a blank line.  "echo ." would echo a dot.
        echo.
        echo Hit Ctrl-C to stop or any other key to continue:
        pause > nul
        for /f "tokens=*" %%i in ('dir %DIR_PARAMS% /a-d /b') do call :EXECUTE %1 %2 %3 %4 %5 %6 %7 %8 "%%~fi"
        goto EXIT
        
        :EXECUTE
        echo %1 %2 %3 %4 %5 %6 %7 %8 %9
        rem 
        rem Note:  The keyword "call" is needed here.  Otherwise, if the first parameter
        rem        is the name of a BAT file, things get confused.  The BAT file is not
        rem        executed, and the following error is reported:
        rem             The system cannot find the batch label specified - EXECUTE
        rem 
        call %1 %2 %3 %4 %5 %6 %7 %8 %9
        goto EXIT
        
        :NOT_NT
        echo Sorry.  %0 only runs under Windows NT, 2000, XP, etc.  Not 95, 98, ME.
        goto EXIT
        
        :NO_DO_FOUND
        echo Invalid syntax.  Must specify DO.
        goto USAGE
        
        :USAGE
        echo %0 is a BAT file that executes the specified command on the specified 
        echo set of files.  The files are specified as a set of parameters that would 
        echo cause the DIR command to select the right set of files.
        echo Usage: %0 [dir_params...] DO command
        echo Examples:  %0 *.* DO type
        echo                    Types all files in the current directory.
        echo            %0 DO type
        echo                    Types all files in the current directory.
        echo            %0 /s DO type
        echo                    Types all files in the current directory tree.
        echo            %0 *.exe DO start /wait /max
        echo                    Runs all EXE files in the current directory, one at a 
        echo                    time, waiting for each to finish, in maximized windows.
        echo            %0 /s /aa c:\*.* DO xcopy /s /m /f 
        echo                    Incremental backup.  Run with A:\ as the current 
        echo                    working directory.  Copies all files with archive bit 
        echo                    set from the C drive to the current directory tree,
        echo                    clearing the archive bits and echoing the names as
        echo                    the files are copied.
        echo            %0 /s /a-r DO edit 
        echo                    Edit all files that are not readonly in the current
        echo                    directory tree.
        goto EXIT
        
        :EXIT
        

        --Fred

    6. IF command

      1. Undocumented IF THEN ELSE

        Original Version: 4/21/1999
        Last Updated: 6/6/2008
        Applies to:  WinNT 4.0, Win2K, WinXP

        Under WinNT, the IF command has an undocumented IF THEN ELSE form:

        	IF condition (then-part) ELSE (else-part)

        The parentheses are required.  For example:

        	if "%1"=="-?" (goto USAGE) else (goto NORMAL)

        Also, you can spread it over multiple lines and include multiple commands, but the open parenthesis must always be on the same line as the IF or ELSE.  For example:

        	if "%1"=="-?" (
        		echo Usage: To use this command, you should...
        		echo Example: An example of typical usage is...
        	) else (
        		echo Starting to do something...
        		call do_something
        		echo Starting to do something else...
        		call do_something_else
        		echo Done.
        	)

        --Fred

    7. Echo a blank line

      Last Updated: 11/25/2001
      Applies to:  Win95?, Win98?, WinMe?, WinNT 4.0, Win2K, WinXP

      How to write a blank line to a file from a Windows batch file?

      Since you can echo the word "hello" with a line like:

          echo hello > file1.out

      you might think you could echo a blank line with a line like:

          echo > file1.out

      However, this form of the echo command reports the current status of the echo flag, as:

          C:\>echo
          ECHO is on.

      Another reasonable guess would be the form that works in Unix:

          echo "" > file1.out

      However, this echoes the quotes themselves, as:

          C:\>echo ""
          ""

      For some reason the following works:

          echo. > file1.out

      The dot following the word echo doesn't get echoed, but prevents the annoying "ECHO is on." message.  Anyone know why?

      --Fred

    8. See Also

      Last Updated: 10/9/2004
      Applies to:  WinNT 4.0, Win2K, WinXP

      The following are good sources of info about batch files in WinNT:

      1. HELP <commandname> from Windows command line.
      2. <commandname> /? from Windows command line.
      3. http://bristle.com/~fred/#windows_command_line
        Links to syntax of, and other info about, Windows command line commands.
      4. Hill, Tim. Windows NT Shell Scripting.  Indianapolis IN: Macmillan Technical Publishing, 1998.  ISBN 1-57870-047-7.
      5. http://www.jsiinc.com/reghack.htm  
        "Windows NT Tips, Registry Hacks, and More........."

      --Fred

  7. Migration Tips

    1. Win2K vs WinNT4

      1. Win2K vs WinNT4 Applications

        Last Updated: 11/25/2001
        Applies to:  Win2K

        Here are some of the differences I noticed in some of the standard applications when I moved from WinNT 4.0 to Win2K last year:

        1. Command line:
          1. Insert mode is on by default.
          2. Command line completion uses a relative path, not absolute.
          3. QuickEdit mode is on by default.

        2. RegEdit
          1. Remembers your previous position in viewing/editing the registry.
          2. Uses a new Unicode format by default for export/import, but still supports the old REGEDIT4 ASCII format.
            [A real nuisance since some of the other utilities (like WinDiff) do not yet support Unicode.]

        3. Dial-Up Networking:
          1. Dials OK, even if the dial tone is beeping due to voicemail.
          2. There seems to no longer be an option to play a sound when the line is dropped.
          3. There seems to no longer be an option to play a sound when a line error occurs.
          4. There seems to no longer be an option to show an icon in the task list and full size icon in the task bar while connected.  You have to watch for the tiny system tray icon to see whether you are still connected.

        4. Explorer:
          1. Many more columns can be displayed for each file (see the View | Choose Columns... menu).
            [Anyone know a way to get it to show a column with the targets of shortcuts like the Unix command ls -l does?]
          2. You can set all folders to use the same view settings.
          3. The properties window for shortcut files opens at the Shortcut tab.
          4. The command line syntax has changed.  The tip:
                    Add Desktop to Start Menu
            doesn't work on Win2K like it does on WinNT4.

        5. Notepad:
          1. File | Print now shows the printer dialog box to allow you to choose a printer, set properties, etc., instead of printing immediately to the default printer with the default settings.  Previously you had to use File | Page Setup | Printer | Properties.
          2. The following standard keys now work: Ctrl-F (find), Ctrl-P (print), Ctrl-S (save), etc.
          3. You can go to a specific line number with Ctrl-G.

        6. FTP client:
          1. You have to put an explicit "bye" command in files passed to ftp via the -s option.  Otherwise, it re-executes the last command and doesn't exit after running the script.
            [I think this is the reason that McAfee VirusScan can't automatically download updated virus signature files on Win2K.]

        7. Telnet client:
          1. Runs in a console window, rather than creating a new window of its own.
          2. Assumes that the telnet server you are connecting to is on a trusted Windows machine on your local LAN, not a Unix machine somewhere else in the world.
            1. Automatically passes your local Windows NT credentials to the remote telnet server via the Windows NT LAN Manager authentication protocol, rather than waiting for the server to prompt you to login.  If you don't want this info handed out to every server you ever connect to, you can fix it by running telnet without specifying any target machine, and using the command:
                      unset NTLM
            2. Sends CRLF, not just LF, after each line.  The effect on a Unix system is double-spacing, as though you hit an extra Enter after each Enter.  To fix this, run telnet without specifying any target machine, then use the command:
                      unset CRLF 
            3. No longer emulates a VT100 terminal by default.  To make your Unix apps run better within the telnet window, run telnet without specifying any target machine, and use the command:
                      set term vt100
            4. To learn more about the current settings and what you can change, run telnet without specifying any target machine, and use the commands:
                      help
                      display
                      set ? 
          3. For more info, see:
                    http://support.microsoft.com/support/kb/articles/Q253/9/18.ASP

        8. Telnet server:
          1. Supports only telnet clients running on trusted Win2K machines on your local LAN, not telnet clients running on Win95, Win98, WinNT, WinMe, or Unix, and not those running on Win2K machines elsewhere in the world.  Specifically, by default, it only allows connections using the Windows NT LAN Manager authentication protocol, which is not supported by Win95, Win98, WinNT, WinMe, and Unix, and which won't work if you have a different username and password on the client Win2K machine than on the telnet server machine.  If the NTLM authentication fails, it does not prompt you for a username and password.  To configure your telnet server to prompt for username and password:
            1. Start the IIS server
            2. Start the telnet server administrator (Start | Programs | Administrative Tools | Telnet Server Administration)
              1. 3 = Display / change registry settings ...
              2. 7 = NTLM
              3. Change the value of NTML to 1 (prompt for login if NTLM fails) or 0 (always prompt for login) from the default of 2 (NTML only).
          2. For more info, see:
                    http://www.jsiinc.com/SUBC/tip1100/rh1168.htm

        9. More filter:
          1. Now offers some of the features of the Unix "more" command:
            1. Previously, the more command displayed another page whenever you hit a key.  Now, it distinguishes among various keys.  For example, you can use space to see the next screen, return to see the next line, p to show the specified number of lines, s to skip the specified number of lines, = to see the current line number, f to skip to the next file, q to quit, and h or ? to see a one-line summary of these choices.
            2. It shows the percent of the file that you've paged through.
            3. It takes command line options that:
              1. Control the treatment of formfeeds, tabs and blank lines.
              2. Clear the screen before starting to display the file.
              3. Start displaying the file at the specified line number.
            4. It takes multiple filenames as command line arguments, displaying them one after the other.
          2. For more info, type:
                    help more

      --Fred

  8. Windows Patches

    1. Fix Windows Daylight Savings Time 2007

      Last Updated: 3/14/2007
      Applies to: Win2K, WinXP

      Want a quick and easy way to update your computer to use the new Daylight Savings Time start and end dates that went into effect in the United States in 2007?  For Win2K, and WinXP, click here:

          FixWindowsDaylightSavingsTime2007.reg

      and then reboot your computer.  That's it!  You're done.  Windows is now patched and will switch into and out of Daylight Savings Time correctly each spring and fall.  

      Note:  Be sure to reboot before you ever double-click on the clock icon at the bottom right of your screen and bring up the Date/Time Properties window because clicking OK in that window resets the registry back to the old wrong values.  After you reboot once, it is no longer a problem.

      And just think...  You didn't have to walk through a "wizard" at the Microsoft Web site, answering questions about your computer, yourself, your non-Microsoft applications, and your firstborn child...  You didn't have to download and run an EXE file that would make this same small change, plus also "fix" a few other things that Microsoft would like "fixed" on your computer, like "fixes" to cause competitors products to stop working on your computer or to install spyware that reports your usage patterns to Microsoft.  You didn't even have to pay the $4000 fee that Microsoft is charging to upgrade servers for some of its corporate clients...  And it's all perfectly legal!  Not bad, eh?

      Details:

      This fix is a Windows registry file.  I dumped it from my Windows registry in a text format, and edited it.  If you want to look at it, you can right click and choose "Save Link As" (Firefox users) , "Save Link Target As" (Netscape users), or "Save Target As" (poor unfortunate Microsoft Internet Explorer users) to download the file.  Then you can open it in Notepad, Word, or any other text editor.  Or just click on it to apply the change to your Windows registry, as recommended above.  If you look at it, you'll see:

      REGEDIT4
      
      [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
      "StandardStart"=hex:00,00,0b,00,01,00,02,00,00,00,00,00,00,00,00,00
      "DaylightStart"=hex:00,00,03,00,02,00,02,00,00,00,00,00,00,00,00,00
      

      The last line tells Windows to start Daylight Savings Time at 2am on the 2nd Sunday of the 3rd month (March).
      The preceding line tells Windows to start Standard Time at 2am on the 1st Sunday of the 11th ("b" in base 16) month (November).

      When you run this file by clicking on it, it overwrites the old settings in your Windows registry, which were:

      REGEDIT4
      
      [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
      "StandardStart"=hex:00,00,0a,00,05,00,02,00,00,00,00,00,00,00,00,00
      "DaylightStart"=hex:00,00,04,00,01,00,02,00,00,00,00,00,00,00,00,00
      

      In these old settings, the last line told Windows to start Daylight Savings Time at 2am on the 1st Sunday of the 4th month (April).
      The preceding line told Windows to start Standard Time at 2am on the last (5 means last) Sunday of the 10th ("a" in base 16) month (October).

      Anybody have any idea why people have made such a big deal of this?  On Unix and Windows both, it is a pretty simple patch.

      Why not just change your clock manually?

      That was my original thought too.  I'm generally a believer in "If it ain't broke, don't fix it".  Rather than risk applying a Microsoft patch to a system that is currently working reliably, and on which I depend, I figured I'd just change the clock manually 4 times a year:  twice to change the clocks at the new dates in the fall and spring, and twice to undo the automatic changes at the old wrong dates in the fall and spring.  However, when I did so, it caused problems with my e-mail.  It would cause similar problems for you with any program that uses dates and times and communicates among multiple computers.

      Here's what happened to me:

      Monday, I changed my clock from 4:27pm to 5:27pm.  However, I didn't change the time zone so I was still using EST (Eastern Standard Time), not EDT (Eastern Daylight Time).  That worked fine for local things like creating files and checking to see what time they were created, etc.

      However, my outgoing mail was being incorrectly stamped as:

          Date: Tue, 13 Mar 2007 17:27:07 -0500

      Many people receiving my e-mail were already set to EDT, which uses an offset of -0400, not -0500, from UTC (Coordinated Universal Time, previously known as GMT, Greenwich Mean Time).  Therefore, their mail programs were converting this from:

          17:27:00 -0500 (EST)

      to:

          22:27:00 -0000 (UTC/GMT)

      and then to:

          18:27:00 -0400 (EDT)

      showing them the time 6:27pm, instead of 5:27pm.  Despite the fact that they might have been very impressed by my time-traveling ability to send them mail from the future, I decided to fix this.

      Similarly, for my incoming mail, they would send as:

          17:27:00 -0400 (EDT)

      which my computer would incorrectly interpret as:

          21:27:00 -0000 (UTC/GMT)

      and:

          16:27:00 -0500 (EST)

      and show me 4:27pm, instead of 5:27pm.  Despite the superior sensation this gave me, of being an hour ahead of everyone else, I decided to fix this too.

      The registry change turned out to be the answer.  Thanks to David Tao for his patience in being a guinea pig as I tested this!

      --Fred

  9. Unix

    1. Connecting to Unix from Windows

      1. PuTTY

        Original Version: 2/20/2012
        Last Updated: 3/8/2012
        Applies to: WinXP, Vista, Win7

        PuTTY is a Windows implementation of the Unix ssh command.

        The ssh command is similar to telnet.  They both allow you to login to a remote system.  However, ssh can also be used to execute a single command on a remote system.  Furthermore, ssh can be used as a transport for other commands, such as scp and rsync, to copy files from one system to another like ftp.  The advantage of ssh (and commands like scp, rsync, etc., that use it) over telnet and ftp is that ssh encrypts all transmissions for security, including the initial username and password.  Finally, ssh can be used to set up encrypted "tunnels" for other protocols like HTTP.

        There is no built-in support for ssh on Windows, so without PuTTY, you'd have to login to remote systems via telnet, sending your password in plain text across the Internet, if any Unix or Linux system administrator were foolish enough to even run a telnet server for you to connect to.

        You can download PuTTY for free from:

        Here are the instructions for how I typically install and configure it:

        --Fred

      2. WinSCP

        Original Version: 2/20/2012
        Last Updated: 3/8/2012
        Applies to: WinXP, Vista, Win7

        WinSCP is a Windows implementation of the Unix scp command.

        The scp command is similar to ftp.  They both allow you to copy files to/from a remote system.  The advantage of scp is that it uses ssh as a transport, so it encrypts all transmissions for security, including the initial username and password.

        There is no built-in support for scp on Windows, so without WinSCP, you'd have to copy files to/from remote systems via ftp, sending your password in plain text across the Internet, if any Unix or Linux system administrator were foolish enough to even run an ftp server for you to connect to.

        You can download WinSCP for free from:

        Here are the instructions for how I typically install and configure it:

        Here is a Windows batch file I use to invoke it in various useful ways:

        Feedback from Dave Tutelman:

        I use WinSCP to maintain one of my web sites.  In addition to file transfer, it allows editing files on the server, without explicitly transferring them to my Windows PC.  (Of course, "under the covers" the file is on my PC, but I did nothing to save it and it goes away after I quit the editor.)  So I can have 4 or 5 files from the server open in separate windows on my screen, editing them with a notepad-like text editor. As soon as I hit "save", I can test my changes on the server.

        Feedback from Vadim Storozhuk:

        If you have not tried it yet, please check out the "Remote System Explorer" (RSE) perspective in Eclipse.

        This is one and only ssh client I've been using for over a year.  It can do ssh terminals, sftp to and from ssh servers, copying files between windows and ssh servers, etc.  Looks dry at first sight, but quite powerful and pretty neat after you play with it a bit.

        --Fred

    2. Running Unix on Windows

      1. Emulators

        1. Cygwin

          Last Updated: 2/20/2012
          Applies to: WinXP, Vista, Win7

          You can run many Unix or Linux applications inside the Windows operating system via the cygwin emulator.  This does not require you to buy a Unix license.  See:

          --Fred

      2. Virtualization

        1. VMWare

          Last Updated: 2/20/2012
          Applies to: WinXP, Vista, Win7

          You can run a full copy of the Unix or Linux operating system inside the Windows operating system via the VMWare virtualization product.  For Unix, this may require you to buy a Unix license, in addition to your Windows license.  See:

          --Fred

        2. VirtualBox

          Last Updated: 2/20/2012
          Applies to: WinXP, Vista, Win7

          You can run a full copy of the Unix or Linux operating system inside the Windows operating system via the Oracle VirtualBox virtualization product.  For Unix, this may require you to buy a Unix license, in addition to your Windows license.  See:

          --Fred

    3. Running Windows on Unix or Mac

      1. Emulators

        1. CodeWeavers CrossOver

          Last Updated: 2/20/2012
          Applies to: WinXP, Vista, Win7

          You can run many Windows applications inside the Unix, Linux or Mac OS X operating system via the CodeWeavers CrossOver virtualization product.  This does not require you to buy a Windows license.  See:

          --Fred

      2. Virtualization

        1. Parallels

          Last Updated: 2/20/2012
          Applies to: WinXP, Vista, Win7

          You can run a full copy of the Windows operating system inside the Mac OS X operating system via the Parallels virtualization product.  This requires you to buy a Windows license, in addition to your Mac OS X license.  See:

          --Fred

        2. VMWare

          Last Updated: 2/20/2012
          Applies to: WinXP, Vista, Win7

          You can run a full copy of the Windows operating system inside the Unix, Linux or Mac OS X operating system via the VMWare virtualization product.  This requires you to buy a Windows license, in addition to your Unix or Mac OS X license.  See:

          --Fred

        3. VirtualBox

          Last Updated: 2/20/2012
          Applies to: WinXP, Vista, Win7

          You can run a full copy of the Windows operating system inside the Unix, Linux, or Mac OS X operating system via the Oracle VirtualBox virtualization product.  This requires you to buy a Windows license, in addition to your Unix or Mac OS X license.  See:

          --Fred

  10. Miscellaneous Tips

    1. Run non-EXE from AUTORUN.INF

      Last Updated: 6/26/1999
      Applies to: Win95, Win98, WinNT 4.0

      To run an EXE file from an AUTORUN.INF file, you use the lines:

      	[Autorun]
      	OPEN=file1.exe
      	ICON=file1.ico

      So how to run other types of files?  Use the START command, as:

      	[Autorun]
      	OPEN="start file1.pps"
      	ICON=file1.ico

      Thanks to Steve Weitzman for this tip!

      --Fred

    2. Why Windows Has No Security

      Last Updated: 2/5/2010
      Applies to: All versions of Windows

      People often ask me why Windows has such security problems.  Why is it so much less secure than Mac, Linux, Unix, VM, VMS, and every other operating system in existence?  The answer lies in its history.

      Decades ago, there were mainframes and Unix computers that were big expensive machines shared by hundreds of users, and it was very important to enforce security so one user couldn't see or change the files of another user.  Then PCs came along for home users.  They had to be cheap enough to buy for your home.  They didn't need security since there was only one user at a time, and no Internet, and you could just lock them in your office to keep your kids from doing any harm.  To make them cheap enough, Microsoft dumbed them down a lot and took out all the security.

      For the next 20 years, Microsoft made operating systems with no security.   Recently, they are trying to add it, after the fact, without breaking all sorts of sloppy programs that assume they can do anything they want to the computer.  It's very hard to add security without breaking things.  Ever add a new lock on a door at work, or institute a new policy requiring higher level management approval?   It interferes with all sorts of shortcuts that people previously took, and forces them to follow the new rules.  Same for computer programs.  Add security after they were written in a security-free world and they all break.  Therefore, Microsoft keeps poking at security in a half-hearted way, but cannot afford to really lock things down.

      Also, Microsoft has no experience with secure systems.  They've specialized in what I call "toy computers" for decades and don't know any better.  The best they typically manage is to effectively lock the front door and leave the back door wide open, hoping no one will notice.   Or to lock the front and back doors, but leave a key under a rock near the back door, hoping that no one will find it, except those programs they left it there for. 

      This concept of "security through obscurity" works fine in lots of non-computer situations.  Admit it -- you have a key to your house or car hidden somewhere, don't you?   You can get away with it because very few people are actively searching under rocks to find your key.  Also, finding a neighbor's key doesn't help them to find your key, because you choose different hiding places.  

      However, in the modern world of computer hackers, "security through obscurity" is a disaster.  To continue the analogy, there are huge numbers of hackers searching under all of the rocks in your yard and the yards of everyone else in the world.  Once they find a key, they write a computer program that automates the process of walking up to a house, getting the key from under the known rock, opening the door, and putting the key back under the rock.  This same program works for any house.  That is, any version of Windows on any computer in the world.

      I've done this myself hundreds of time.  Someone comes to me complaining that their computer is locked down to prevent them from doing something that they reasonably need to be able to do.  I show them how to change the setting in the Windows "registry" that says they are not allowed.   If they are not allowed to change the setting, I show them how to change another setting that says they are not allowed to change the first setting.  If it gets to be too complicated, I write them a little program that automatically changes the settings for them.

      In the Windows world, there is no real security.  There is only obscurity.   But these days, it is very hard to keep a secret.  Anyone can learn anything with a simple Web search.  Unfortunately, people are starting to use Windows in non-"toy" situations, where security really matters.  That's why security experts and even common newspapers like the Washington Post are warning people to not use Windows for on-line banking or any other tasks where security is important.

      On the other hand, the Mac OS X operating system and Linux are both based on Unix, which already has very good security.  Has had it for 40 years or more.   Most of the holes were found long ago.  There's never been a need to leave back doors open or keys under rocks to accommodate old programs.  No programs were ever written that assumed a security-free world.   Such programs would have failed right from the start.

      --Fred

©Copyright 1998-2014, Bristle Software, Inc.  All rights reserved