Windows Power Tips

Tips for Windows Power Users

Written by

Barry Stanly

Printed on August 26, 2022

Copyright 2021 by Barry Stanly

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is available at: https://www.gnu.org/copyleft/fdl.html.

The documentation system is hosted at https://sourceforge.net/p/simpletextformatter

A PDF version of this document may be downloaded from
https://sourceforge.net/projects/windows-power-utilities/files/WindowsPowerTips.pdf/download

Because of the limitations of the Wiki formatter, the font size has been increased to make this document easier to read. The PDF version should be used if the font seems too big.


Preface

This document was written as a background material for the utility programs that grew out of a book, Nuances In Computing (NIC), that I was writing at the time. The book remains unpublished, but shows up as a frequent reference for utilities that it spawned(1).

I have found the utilities and techniques of sufficient use to donate them to the public domain. However, there is a common background in tips and tricks common to computing that I have gathered together in this document to avoid having to repeat them every time I try to document a utility. Included is material relevant to using Windows, but not related to the NIC utilities because it is useful and fits in well with the rest of the material.

So this document is recommended reading as background to using the NIC utilities. The document was written for persons with an intermediate skill level in using Windows. Experts will likely already be familiar with the material.

I have gathered material over the years from many sources and presented it here as a best effort. I have tried to identify sources, where possible. However any errors or omissions are mine.

This document assumes Windows 10. Differences between Windows 10 and Windows 11 are noted.

Hopefully you will find the utilities and techniques useful.

Barry Stanly
August 26, 2022


C O N T E N T S

Preface

1 Introduction
1.1 Getting Help
1.2 The Basics
1.2.1 The Windows File System
1.2.2 Shortcuts
1.2.3 Windows Environment
1.2.4 Windows Desktop
1.2.5 Adjusting the Display
1.2.6 Naming Your PC
1.2.7 Running Programs
1.3 Organizing Your Desktop
1.3.1 Reducing Desktop Clutter
1.3.2 Locating the Home Folder
1.3.3 Using a Favorites Folder
1.4 Saving Your Data
1.5 Special Folders
1.6 Using Legacy Programs
1.7 Home Networking
1.7.1 Home Network Sharing
1.7.2 Sharing Devices
1.7.3 Securing A LAN
1.8 Preparing for Disaster
1.9 Screen Images Folder

2 Running Programs Revisited
2.1 Special Folder SendTo
2.2 Stocking Folder SendTo
2.3 Controlling Windows' Behavior

3 Shells
3.1 Merging Linux with Cmd.exe
3.2 Launching a Shell
3.3 Common UNIX Commands
3.4 Short Synopsis of Cmd.exe

4 Utilities

5 Applications
5.1 WordPad
5.2 Notepad
5.3 Image Editing
5.4 Third Party Apps
5.4.1 LibreOffice
5.4.2 Python
5.4.3 MS Visual Studio
5.4.4 Winmerge
5.4.5 Macro Editor
5.4.6 Aspell

A P P E N D I C E S

A Windows Shell Folders

B Windows Environment

C Emacs Initializaion File

D Recommended Applications

E Preparing for Disaster
E.1 Securing Your PC Against Malware
E.2 Securing Your Network
E.3 Extras

Index

T A B L E S

Table 2.3-I Selected Windows Special Folders
Table 3.3-I Common Linux Commands
Table 3.4-II Cmd.exe Parameter Fields
Table 3.4-III Cmd.exe Common Subcommands
Table 4-I OCR Utilities
Table A-I Windows Shell Folders
Table B-I Typical Windows Environment
Table D-I Recommended Third Party Applications
Table D-II Optional Third Party Applications

F I G U R E S

Figure 1.2.4-1 A Typical W10 Taskbar
Figure 1.2.4-2 A Typical W11 Taskbar
Figure 1.2.5-3 Folder View
Figure 1.2.5-4 Options View
Figure 1.2.5-5 Folder View Recommendations
Figure 1.2.7-6 A Typical Start Menu
Figure 1.2.7-7 Original Context Menu
Figure 1.2.7-8 Modified Context Menu
Figure 1.3.2-9 Changing Icons
Figure 1.3.3-10 Adding A Favorites Folder
Figure 1.3.3-11 Adding Desktop Toolbar
Figure 1.3.3-12 Using The Desktop Toolbar
Figure 1.6-13 Locating System Environment
Figure 1.6-14 Editing the System Path
Figure 1.6-15 Adding a New Path
Figure 1.7-16 Home Network
Figure 1.7.1-17 Network Sharing Center
Figure 1.7.3-18 Setting up an ACL
Figure 1.7.3-19 Configuring an ACL
Figure 1.7.3-20 Home Network
Figure 2-21 Starting a program with Executor Launcher Script
Figure 2.1-22 Opening a Shell Window
Figure 2.2-23 Creating a Desktop Shortcut
Figure 5.1-24 WordPad -- Initial Setup
Figure 5.1-25 WordPad -- Adjusting Line Wrap
Figure E.3-26 Editing PDF preferences
Figure E.3-27 Disabling Java Script



1 Introduction


Begin at the beginning
and go on till you come to the end;
then stop -- Lewis Carroll, Alice in Wonderland

Taking our cue from Lewis Caroll, we will summarize the basics before going on to the subtleties. The following discussion assumes that the reader already has some experience using PC's.


1.1 Getting Help

The web is your friend. Most questions can be answered with a web search in your favorite browser. Just type your question in the address bar. The browser will generate a web search to answer it. Pithy questions seem to work better than verbose ones.

Frequently adding a site name to your question can get an answer faster. Stackoverflow and howtogeek are two good answer sites. As an example: Stackoverflow add to application context menu will display information on how to work with Windows context menus.


1.2 The Basics

Two of the main functions of an operating system, Windows in this case, are to organize files for use and to run programs when requested. The Windows file system is discussed first.


1.2.1 The Windows File System

Early on in the development of the Personal Computer (PC) IBM introduced a PC which became the defacto standard for what is now known as the IBM PC (or just a PC), even though IBM no longer manufactures them.

IBM PC files are divided into drives (storage devices.) These are identified by a letter (A-Z). The first PC's came with two floppy drives, labeled 'A' and 'B'. The next major advance was the introduction of PC's with built-in hard drives. Since A and B were taken, the hard drive was labeled 'C'. This convention persists to this day and the main drive is always labeled C. By convention, the drive identifier ends with a colon (':'). This identifies the main folder (also referred to as the main directory) on the device. This folder contains files and sub-folders
(also referred to as subdirectories.) A file is the lowest level identifier and represents a named block of storage on the drive. A folder is a grouping entity. Folders can contain more sub-folders as well as files.

A path is the complete name of a file or folder. Windows paths are written syntactically as follows:
C:\Folder1\Folder2...\Foldern\File.ext, where:

  1. 'C:' is the drive identifier (C in this case.)

  2. '\' is the path separator that separates folder and file names.

  3. Folder1...Foldern are the folder names.

  4. 'File' is the file name.

  5. and '.ext' is the file extension, also referred to as the file type.
    As much as possible it is recommended that non alpha-numeric characters not be used in file and folder names. Every once in a while an older, but very useful, program is encountered that cannot properly deal with exotic path names. Traditionally the following characters are safe to use in path names:
    A-Z, a-z, '-', and '_'. Special characters, including spaces and ampersands ('&') should be avoided. An additional consideration is that Windows does not distinguish between upper and lower case letters in path names. This is not the case for Linux (UNIX) path names. Thus while Windows treats Abc.dat and abc.dat as the same file, Linux treats them as different files. So try to be consistent in your use of alphabetic case in naming files as they may someday be used on a UNIX file system and you can get inconsistent results.


1.2.2 Shortcuts

A windows shortcut is a link to a file on the PC or in the cloud. Typically they are used to point to web addresses (URL), personal folders, or executable programs.

To create a web shortcut, open a browser and grab the lock symbol in the address bar with the mouse and drag it to the desktop. Rename the shortcut if desired. Then double clicking on the shortcut will reopen the webpage you dragged it from.

To create a shortcut of a file (or folder) on your PC, right-click on the file (or folder) and select Create Shortcut. A shortcut to the item will be created. You can rename the shortcut just like any file or folder: Right-click and select rename, or slow click until the name softens, then type in the new name.

You can change the icon associated with the shortcut by right clicking on it and selecting change icon. Walk through the available icons until you come to one that is meaningful to you and select it. That will change the appearance of the shortcut. See Figure 1.3.2-9 for an example.

A shortcut is a file, you can copy, move, or rename it as desired.


1.2.3 Windows Environment

The Windows Environment is an in memory keyed database. There are two environments: The System Environment and the User Environment. When a user accesses the environment, Windows first searches the User Environment and then the System Environment so that the User Environment shields the System Environment. The primary purpose of the User Environment is to support customization across different users. Since I do not share my PC, I almost always use the System Environment.

Environment variables are referenced by enclosing them in percent signs ('%'). For example, entering %Public% in the file manager (Explorer) address bar will display the public folder. Environment keys are not case sensitive, so %PUBLIC% and %Public% represent the same folder. Appendix B contains more information.


1.2.4 Windows Desktop

The Windows desktop is a folder whose contents appears on the display screen. The taskbar usually is at the bottom of the screen. The anatomy of a Windows 10 taskbar is shown in figure 1.2.4-1. Clicking on the Date/Time opens a calendar. Clicking on the Start Menu opens the start menu(2), see figure 1.2.7-6. Typing a string in the search window causes Windows to search the PC and the web for the corresponding string.

Figure 1.2.4-1 A Typical W10 Taskbar



Figure 1.2.4-2 A Typical W11 Taskbar



1.2.5 Adjusting the Display

Windows comes configured for novice users. This is a smart policy from Microsoft (MS), but it interferes with power users. So the first thing to do is to change the display to be more explicit. The main thing that causes pain is Windows is configured to omit the display of common file extensions. The theory being a novice doesn't know or care that a file name ends with ".docx", the user just wants to write documents or process e-mail.

A power user, however, needs to know the extensions. A simple example is, say a command file. Command files end in ".bat". If the display of extensions is inhibited, you can wind up with a file named, say MyCommand.bat.docx. Because the ".docx" doesn't display the power user expects double clicking on the file to execute a command, instead it opens a word processor. Very confusing also hard to rename, since Windows is protecting you from accidentally changing word processor files into something else.

To fix this problem, open explorer (click on the file icon at the bottom of the screen.) Select View, see figure 1.2.5-3.

Figure 1.2.5-3 Folder View


Then click Options, see figure 1.2.5-4. Then click View under Options, see figure 1.2.5-4.

Figure 1.2.5-4 Options View


I recommend the settings shown in figure 1.2.5-5.

Figure 1.2.5-5 Folder View Recommendations




1.2.6 Naming Your PC

The default name for a PC is (IMHO) hard to remember, so I always try to pick a name that is meaningful to me and rename the PC to use that name. Entering "name" in the search box (bottom left corner of the screen.) displays "View Your PC Name". Click on that. This opens the PC About Box. About halfway down the page is Rename This PC. Click on that to change the name of your PC. Avoid spaces and special characters, they can cause useful apps to fail.


1.2.7 Running Programs

Double-clicking

File extensions are usually associated with the program that typically edits or uses them. Thus ".docx" files are associated with a word processor (typically MS Word or Libreoffice.) So to open the word processor, double click on a ".docx" file.

Start Menu

Another way to launch programs is to use the Start Menu. The Start Menu is accessed by clicking on the little window in the bottom left of the screen. The start menu opens and on one side are useful shortcuts, on the the other side is a list of all the programs installed. I usually edit the shortcuts to be useful to me and delete that which I don't use. You can drag the shortcuts around to put the most useful ones on the bottom and the more rarely used ones on top. You can right-click and delete them. You can right-click on a program and choose add to start to add them to the start menu. See Figure 1.2.7-6 for a typical Start Menu.

Figure 1.2.7-6 A Typical Start Menu


Taskbar

An additional way to run programs is to use the Taskbar. The Taskbar is (usually) located at the bottom of the screen. Putting the mouse at the bottom of the screen displays the Taskbar(3). See figure 1.2.4-1. A typical Windows 11 Taskbar is shown in figure 1.2.4-2. Notice that the desktop toolbar is missing. A good feature added is the multiple desktop control. This supports multiple virtual desktops with differing backgrounds. A truly useful feature.

To add a shortcut to the Taskbar, right-click on a program and choose Add to Taskbar. After that clicking on the taskbar icon will launch the program.

Context Menu

Another way is to add to a file's context menu. This can be done via the registry or by using PowerShell. However there is an easier way that works most of the time. And that is to open the file using the program you wish to add to the context menu. After that, most of the time, Windows will remember your choice and make it available. Windows is pretty good at remembering standard Windows programs. For example, right-clicking on file tmp.dat opens it's context menu. This is shown in figure 1.2.7-7. Notice that SM Media Player and Wordpad are available to open files of type dat. To add Notepad as an additional choice, we open tmp.dat using Notepad by right-clicking on tmp.dat and selecting Choose another App. Notepad is an available choice, so we choose it. And then close Notepad. Now when we right-click on tmp.dat, Windows remembers our choice as shown in figure 1.2.7-8.

Figure 1.2.7-7 Original Context Menu



Figure 1.2.7-8 Modified Context Menu


Locating Programs

There are times when you need to know where a program is stored. On a 64 bit OS, as most are today, 64 bit based, non OS, programs are stored in C:\Program Files, where as 32 bit, non OS, based programs are stored in C:\Program Files x(86).

If Windows knows where a program is stored, then opening a shell window and entering Where 'Program-Name' will display its location. However programs launched by shortcut don't always show up. For these programs, the Task Manager provides a way to locate
them. The Task Manager displays all the currently active tasks and can be used to also display the resources they use. It can also be used to terminate tasks. Some ways of launching the Task Manager are to 1) enter TaskManager in the search window, 2) press <Windows-key>R and enter TaskMgr, or 3) press <Ctrl><Shift><esc>. Launch the program of interest and launch the Task Manager. Expand the view by clicking More Details in the lower left corner and right-click on the program name and select Open File Location. This will disclose where the program is stored.


1.3 Organizing Your Desktop

The following paragraphs contain suggestions on how to organize the computer desktop.


1.3.1 Reducing Desktop Clutter

It is very easy to let the Windows desktop become so cluttered as to be unusable. For some reason every program that is installed seems to feel the obligation to add just one more shortcut to the desktop. My solution is to add a folder on the desktop named Junk. Then shortcuts that are not in daily use get moved into Junk. They are still there in case I need them, but they no longer clutter the desktop (or my mind.) I try to have a single column of ready-use shortcuts and the rest are in reserve.


1.3.2 Locating the Home Folder

Windows does not seem to have an easy way to open the home folder. So I add an icon on the desktop that opens the home folder. One way to do this is to:

  1. Open Explorer (click on the file icon at the bottom of the screen) and move to folder C:\Users.

  2. Right click on your user name and select create shortcut.

  3. Windows will not allow a shortcut in C:\Users, so it will offer to put it on the desktop. Choose Yes.

  4. Slow click on the new shortcut and rename it to "moi", or some other name that seems reasonable for the home folder such as your user name.

  5. Right click on the shortcut and choose properties.

    Figure 1.3.2-9 Changing Icons


  6. Choose to change the icon, See figure 1.3.2-9 for an example.

  7. Continue to walk through the candidate icons until you find one that you like.Click OK and exit properties.

  8. After that double clicking the shortcut will open the home folder.


1.3.3 Using a Favorites Folder

In addition to a Desktop Junk folder, I find a Favorites folder to also be useful. To create one, right-click in an open spot on the Desktop, click New, click Folder. See figure 1.3.3-10. Windows will insert a new folder, named New Folder. Rename this new folder to Favorites. You will see a Folder, named Favorites appear on your desktop. Populate your Favorites folder with shortcuts to your favorite folders. (You can also use Favorites to launch programs.) When the shortcuts in Favorites start to get cluttered, you can create folders inside of Favorites and move the shortcuts inside of the sub folders to organize them into groups.

The Desktop Toolbar is a feature of Windows 10 that was not ported to Windows 11. So Windows 11 users should directly use the favorites folder instead of a Desktop Toolbar.

A Favorites folder alone is useful, but not an efficient way to use shortcuts. A better way is to use the Desktop Toolbar. The Desktop Toolbar is added by right-clicking on the taskbar (at bottom of screen) and selecting Toolbars and clicking Desktop. See figure 1.3.3-11. Notice that folders inside of Favorites expand to show their content. See figure 1.3.3-12 for an example of use.

Figure 1.3.3-10 Adding A Favorites Folder



Figure 1.3.3-11 Adding Desktop Toolbar



Figure 1.3.3-12 Using The Desktop Toolbar



1.4 Saving Your Data

It is a good idea to have an offsite (cloud) backup system. This protects against accidental data loss and also against Ransomware. As a little bit of misdirection against malware, I usually locate my data in either C:\Users\'you'\U or in D:\U, where the latter case uses a second drive for data storage. In the second case, it is a good idea to put a shortcut to the second drive in your home directory. That way your configuration stays the same if you switch between a single drive or dual drive configurations. The shortcut to D:\U would be named U and be located in C:\Users\'you'. The backup system is then configured to backup C:\Users\'you'\Documents and C:\Users\'you'\U (or D:\U.)

For things that I don't want cluttering up my backup, I use a temporary folder named C:\Users\'you'\Z (or D:\Z if a second drive is used.) Again a shortcut to D:\Z is placed in the home folder. Similarly folder C:\Users\'you'\Z\Documents2 is used to hold temporary documents. A shortcut to Documents2 is usually placed inside of Documents to make it easier to access Documents2 when saving data.


1.5 Special Folders

There are several folders that have special significance in Windows. We have already encountered one: The Desktop folder. Files and images copied to the Desktop appear on the screen. Here is a list of the special folders that I find useful:

  1. Common Startup -- Command files and programs placed here, directly or by shortcut, are executed when the PC starts up.

  2. Desktop -- Discussed previously. The Desktop folder is useful in controlling the display screen.

  3. %Public% -- Public file folder.

  4. %Public%\Cmds -- By convention, user commands and scripts are located here, see paragraph 1.6.

  5. %LocalAppData%\Programs -- This is where Windows stores local apps. A local app is a program that is known to the current user account but not to other user accounts.

  6. Screen Images -- This is where the startup display images are stored, see paragraph 1.9.

  7. SendTo -- Shortcuts to commands that explicitly operate on user files go here.

  8. %AppData%\Microsoft\Windows\Start Menu\Programs\Startup -- Command files and programs placed here, directly or by shortcut, are executed when a particular user starts the PC.
    See Appendix A for a more complete list. Uses for these folders are discussed later.


1.6 Using Legacy Programs

Legacy Programs are programs and scripts developed for earlier versions of Windows or for other operating systems that are sufficiently useful to warrant including them in your command repertoire. Windows has at least two ways of referencing programs:

1) The main-stream way is to add the relevant information on how to use the program to the Windows Registry, a database containing all the relevant information on the Windows configuration. There are books on how to do this.

2) The second way is to add the enclosing folder to the current path. The current path is a list of folders containing executable programs. If a program or script is in the current path, Windows knows how to launch it.

Here is one way to add folders to the current path:

  1. Enter Environment in the search box, see figure 1.6-13.

  2. Edit System path, see figure 1.6-14. Click Edit.

  3. Click New, see see figure 1.6-15.

    Figure 1.6-13 Locating System Environment



    Figure 1.6-14 Editing the System Path



    Figure 1.6-15 Adding a New Path


    The first path to add is C:\Users\Public\Cmds. First open explorer and enter shell:Public in the address bar. Then right-click and select new folder. Rename the folder to Cmds. This adds the Cmds folder to the Public folder. Then follow the above procedure and add Cmds to the path. At that point any programs or shortcuts added to Cmds are known to Windows and can be launched by name.


1.7 Home Networking

This paragraph presents a short synopsis of home networking from the standpoint of how a user manages and secures his or her network. It is not meant to cover all aspects of networking.

A home network is a Local Area Network (LAN). A LAN is a collection of devices connected together in one physical location. Most Home Networks connect their devices either via a physical cable, termed an Ethernet cable, or via a radio, termed a WiFi. The LAN is managed by a router. The router assigns an Internet Protocol (IP) address to each device and is responsible for managing the messaging between the cable modem and the LAN and any messages between devices on the LAN. The cable modem accepts the data stream from the router and connects it to a cable provider. The cable provider connects the home data stream to the internet -- see Figure 1.7.

Not shown in the sketch are a home telephone system or a cable TV connection, both of which can be provided by the cable modem.

The Media Access Control address (MAC Address) is a part of each device. The IP address is assigned to each device by the router. The MAC Address is suppose to be world wide unique. Each connection has a MAC address. Thus if a PC has a wireless connector and an Ethernet connector, both connectors have separate MAC addresses. However only active LAN connections have IP addresses. So if a connector is not being used, it will not have an IP address. Think of the IP Address as the LAN name and the MAC Address as the device name. Notice that each device can connect to other devices in the World Wide Web (WWW), and also to other devices on the LAN.

Sometimes the cable modem and the router are combined into a single device, but the functionality is the same as shown in the diagram.

Figure 1.7-16 Home Network



1.7.1 Home Network Sharing

The first thing to do is to enable network discovery so you can see what's on your LAN. This is done under Network Sharing. See figure 1.7.1-17 for typical settings.

Enter Network in the search box and click on Network And Sharing Center to see the current network sharing status. Public networks are normally not shared, only private networks are shared.

Figure 1.7.1-17 Network Sharing Center


IP Addresses

Typical Home IP addresses are written as follows:
[192.168.0.n] or [192.168.1.n], where "n" ranges between 1 and 255. Thus the typical home network can address 255 devices. It is possible to address more devices on a LAN, but home networking typically follows the previous schema.

Ping

You can determine if a device is operational by pinging it. Thus from PC-1, you can tell if PC-2 is awake by opening a terminal (Enter <Windows>R cmd, See pp 3.2.)
Ping PC-2 -- see pp 1.2.6.
Ping will send messages to PC-2 and, if awake, PC-2 will respond. You can also use PC-2's IP address, as in:

Ping 192.168.1.7
Pinging 192.168.1.7 with 32 bytes of data:
Reply from 192.168.1.7: bytes=32 time=5ms TTL=128
Reply from 192.168.1.7: bytes=32 time=3ms TTL=128
Reply from 192.168.1.7: bytes=32 time=3ms TTL=128
Reply from 192.168.1.7: bytes=32 time=3ms TTL=128
 
Ping statistics for 192.168.1.7:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 3ms, Maximum = 5ms, Average = 3ms

This clearly shows that PC-2 is alive and well enough to respond to a ping.

Ping is not limited to devices on the LAN, but may also be used to see if the internet is working. Most Universites and many commercial web sites support Ping(4). For example

Ping UCLA.edu

This will 'ping' UCLA. UCLA will respond simliarly indicating that you have network access.

LAN Addressing

The Microsoft Uniform Naming Convention (UNC), specifies the syntax to identify a network resource, such as a shared file, directory, or printer. The UNC syntax for Windows systems has the generic form:

\\ComputerName\SharedFolder\Resource

Sometimes this is referred to as a network path.

Folder Sharing

This means that you can share a folder on a home PC and then access that folder from other PC's on the LAN. A password is required, so the folder is exposed with the same security as the PC login. Typically right-click on the folder to be shared and select properties. Then select sharing.

Entering \\Computer-name in the search box (bottom left corner of the screen) will open the device for network access and display any shared folders. Click on the shared folder and enter the password to obtain access.


1.7.2 Sharing Devices

There are two types of devices that are typically shared on LANs: Printers and Network Attached Storage (NAS) devices.

If a PC is being used as a print server, meaning the printer is physically attached to the PC by a cable, then to share the printer with other PC's on the LAN, click on the printer name and enable sharing. You may have to enter the PC password the first time you access the printer from another device.

NAS Devices

Many routers support inserting a USB drive in a USB slot in the router and using that as an attached storage device. Your router user manual should show how to access it. For Netgear routers, the NAS shows up with the name \\ReadyShare, so entering \\ReadyShare in the searchbox displays the storage device.

The corresponding user manual should show how to access the NAS for other devices. Frequently entering the router model and NAS in a web browser will show how to access the USB drive.


1.7.3 Securing A LAN

There are several things that should be done to secure a home network:

  1. Use a modern router with a firewall.

  2. Use the most advanced encryption algorithm that all your equipment supports. At present this is usually: WPA2-PSK. (WPA3 is available, but only newer devices support it.)

  3. Set up network sharing so that the network behind the firewall is marked as a private network and the network outside the firewall is marked as a public network. See figure 1.7.1-17. Marking the inside network as private enables sharing between home PC's.

  4. Set up an Access Control List (ACL) on the router. An ACL is a list of device names plus Media Access Control (MAC) Address. The idea is only devices in the ACL can use the local WiFi. Direct cable connections are not part of the ACL because they have direct physical access. An ACL is essential to securing a home network. Figure 1.7.3-18 shows a typical router configuration screen with the button to setup the router ACL. Figure 1.7.3-19 shows a typical router ACL configuration screen. Notice it pairs device names with MAC addresses.

    Figure 1.7.3-18 Setting up an ACL



    Figure 1.7.3-19 Configuring an ACL


  5. Usually your router acts as an DHCP server. DHCP stands for Dynamic Host Configuration Protocol. It means that your router assigns IP addresses to all your LAN equipment. It is a good idea to also use permanent IP assignments so that it is easy to address your equipment.

    Figure 1.7.3-20 Home Network


    Figure 1.7.3-20 shows a typical router DHCP configuration screen. Notice that it associates IP Addresses and device names with MAC addresses.


1.8 Preparing for Disaster

All PC's fail eventually. It is just a question of when and how. Some of the ways a PC can fail are:

  1. A drive can cease functioning.

  2. The PC can become infected with Ransomware.

  3. You can get a computer virus.

  4. etc.
    The best thing to do is to prepare for a disaster in advance. That way when disaster strikes, you can recover. Preparing for disaster is discussed in Appendix E.


1.9 Screen Images Folder

When Windows starts up, it displays a picture on the desktop. The picture varies from logon to logon, but usually remains until the user logs in. At times it is nice to be able to access the folder where these images are stored. The folder is stored in a different place on each PC, however it does have a regular pattern to its name. The screen images folder path looks like:
C:\Users\'User'\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_'Random_chars'\LocalState\Assets.

To locate the screen images folder on a PC, enter: %LocalAppData%\Packages in the File manager address bar. Then open folder Microsoft.Windows.ContentDeliveryManager_'Random_chars', where 'Random_chars' represents a short sequence of random characters. Then open folder LocalState, and finally open folder Assets. Inside this folder (C:...\Assets) is set of files with long random names. Copy several (or all) of the files to a temp folder. Inside the temp folder, right-click one of them and select Send To --> Shell (see figure 2.1-22). This opens a shell window. Inside the shell enter: ren * *.jpg. This gives the correct file extension to the files. Then double-clicking on one will open it in an image viewer.

If you plan to access the folder often, add a shortcut to your Favorites folder. I named mine ScnPic. So when I select Desktop-->Favorites-->ScnPic, it opens my screen image folder.


2 Running Programs Revisited

There are two main ways of looking at programs (or scripts):

  1. A program stands alone referencing a fixed set of files or folders. The Start Menu or the Taskbar are good ways of launching this type of program.

  2. A program operates on a particular file extension, so it is connected to that extension. The double click mechanism is the traditional way of launching this type of program. The context menu (right-click) is used to provide limited choices. The SendTo special folder can be used to provide variability to the choices. More on this folder in a moment. An additional way of providing more choices is to use a launcher program(5) or script, see figure 2-21. The way a launcher program works is you double click on the file of interest and the launcher program is launched. The launcher program then presents a menu of choices. Because it is a program, the degree of variability in choices and actions is greatly enhanced.

    Figure 2-21 Starting a program with Executor Launcher Script




2.1 Special Folder SendTo

The SendTo folder provides a way to operate on any file with a program or script. The double click mechanism is used to bind a program to a set of file types. For example double clicking on a .txt file usually launches an editor (typically Wordpad or Notepad), while double clicking on a .docx or .doc file launches a word processor (typically MS Word or Libreoffice.)

What about the need to operate on an arbitrary file? This need is filled by the SendTo special folder. The way it works is you store a shortcut to the program or script of interest in the SendTo folder. Then when you right-click on a file (or folder) you select SendTo and the program name. This invokes the program and passes it the path of the specified file.

There are many applications of this mechanism. For example suppose you want to open a shell window(6) in the same folder as a file? The NIC Utilities includes a script to do just that (named Shell.bat.) You store Shell.bat in C:\Users\Public\Cmds and a shortcut to Shell.bat in SendTo and then select Shell in SendTo and it opens a shell window in the desired folder. See figure 2.1-22.

Figure 2.1-22 Opening a Shell Window



2.2 Stocking Folder SendTo

You can stock folder SendTo manually. An easy way to do this is to open folder SendTo by using <Windows-Key>R to open a run dialog and then entering Shell:SendTo. Then open a Desktop window similarly by using Shell:Desktop instead of SendTo.

Open an Explorer window that contains the file you wish to add to SendTo and right-click on the file name, select SendTo, select Desktop (Create Shortcut), see figure 2.2-23. In the Desktop window rename the shortcut to an appropriate name for SendTo (usually just the file name), possibly change the icon as well (see figure 1.3.2-9, and move it into the SendTo folder.

Figure 2.2-23 Creating a Desktop Shortcut



2.3 Controlling Windows' Behavior

As mentioned previously a right mouse click opens the context menu associated with the active program. For example if you are using Explorer, the Windows file manager, a right click on a file opens the explorer context menu for that file extension; while a right click on the desktop opens the Desktop Window Manager context menu. In both cases the actual menu displayed depends on the item selected and the Registry. The Windows Registry is a hierarchical database that controls the low-level behavior of Windows.

Windows' variable behavior is controled via values in special folders and the registry. Most special folders may be accessed via the shell command or by path name. Some of the more important special folders are as follows:

Table 2.3-I Selected Windows Special Folders

Shell Cmd

Path

Description

shell:Common Startup

%ProgramData%\Windows\ Start Menu\Programs\StartUp

Programs run at system startup

shell:Desktop

%HomePath%\Desktop

Files show on desktop

shell:Downloads

%HomePath%\Downloads

Default download folder

shell:Profile

%HomePath%

Home folder

shell:Public

%Public%

User Common Folder

shell:SendTo

%AppData%\Roaming\Microsoft Windows\SendTo

Program Folder

shell:Startup

%AppData%\Roaming\Microsoft\ Windows\Start Menu\Programs\ Startup

Programs run at user startup

 

%AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\ TaskBar

Taskbar programs

See Appendix A for a more complete list.


3 Shells

A shell is a program that provides access to an operating system's services. There are two types of shells: A Command Line Interface (CLI) shell and a Graphical User Interface (GUI) shell. Cmd.exe and PowerShell are CLI shells -- you ask for services by using the keyboard. Windows Explorer is a GUI shell -- you ask for services by interacting with the computer screen. Just to keep life interesting there are also several Linux (UNIX) CLI shells and a few specialty programs that act like GUI shells. All of which a power user can wind up using to accomplish tasks on a modern PC. Cmd.exe is sometimes referred to as a Dos shell because it implements the original Dos shell commands.

For Windows the two most important shells are Windows Explorer and PowerShell. Explorer is the main user interface for Windows. PowerShell is designed to be able to command the PC to do anything that Windows is capable of. Arguably it's syntax is not optimal from a human factors standpoint, but there is no arguing with its ability to accomplish tasks. The main reason for using other shells under Windows is that they have encapsulated capabilities in a few commands that would require writing small programs (called Commandlets) in PowerShell. Thus it is frequently quicker to use a Linux shell or Cmd.exe instead of PowerShell. For that reason, it is important to be conversant with several shells.

As an aside, Linux is a PC Version of UNIX. UNIX was developed in the mid-1960s when the Massachusetts Institute of Technology, AT&T Bell Labs, and General Electric were jointly developing a multi-user operating system called Multics. UNIX was originally a single-user operating system, so it was called UNIX. The history of UNIX and Linux is worth several books. The interested reader is referred to Wikipedia to start (https://en.wikipedia.org/wiki/History_of_Unix.) An interesting discussion group involving some of the still living Principals is The Unix Heritage Society which may be accessed from https://www.tuhs.org/.
Linux is intimately connected with the GNU project and the Free Software Foundation (FSF) which may be accessed at https://www.gnu.org. This document freely interchanges the terms UNIX and Linux because they are variants of the same system(7).

One of the uses of a shell is to support choices in accomplishing tasks. It can be awkward to program complex logic in a shell language. So shells are frequently supplemented with either a scripting language or a compiled language. The difference between a scripting language and a compiled language is scripts are interpreted and a compiled language results in a program that directly executes the native language of the computer. Functionally the main difference between them is GUI's are easier to write in a compiled language (IMHO)(8).

The most important (non-shell) scripting languages typically used on Windows are Java and Python. The most important compiled languages in use on Windows are c, C#, and VB.net. The main advantage of Java and Python is that they are portable in that they run on Windows, Linux, and Macintosh PC's. Of the two I find Python easier to program in and work with. As far as a compiled language, I prefer vb.net(9)

The NIC Utilities are written in c, python, vb.net, Cmd.exe, and PowerShell.


3.1 Merging Linux with Cmd.exe

Currently Windows supports adding a Linux subsystem as an alternative shell. I prefer to merge the Linux commands with the Windows batch commands to form a hybrid system(10). The way this works is the standard Linux commands have long been ported to Windows. The way to merge them is to save the Linux commands in a folder, say C:\Users\Public\Cmds\UnxUtils. Then add UnxUtils to the Windows path as discussed in section 1.6.

The UNIX utilities may be downloaded from SourceForge:(11) https://sourceforge.net/-projects/unxutils/. Uncompress the zip file and store the utilities in C:\Users\Public\Cmds\UnxUtils. (The utilities unzip to ...UnxUtils\usr\local\wbin.) I recommend renaming sort to wsort, find to wfind, and tar to wtar to avoid a name collision with the Windows version of these commands.

Once the merge(12) is accomplished, Linux commands may be freely intermixed with Windows commands extending Cmd.exe to support the best of both worlds.


3.2 Launching a Shell

The usual way of launching the Windows GUI Shell, Explorer, is to click on the file icon in the task bar at the bottom of the screen. You can also launch it by entering Explorer in the search window (left side of task bar) and selecting the File Explorer app, and by entering <Windows-Key>R Explorer, or by entering <Windows-key>R Shell:'Folder-Id' -- this will open Explorer in the corresponding folder. You can also launch a second GUI shell from Explorer's File menu (top left in the window) by clicking on File and selecting File --> Open New Window(13).

As an example <Windows-Key>R Shell:Public will open C:\Users\Public, see table A-I for a list of folder Id's.

Some of the ways to launch a CLI Shell are:

  1. Enter Cmd or Cmd.exe in the search window.

  2. Enter PowerShell in the search window and selecting PowerShell.

  3. Holding the shift-key(14) and Right-Clicking on a folder in Explorer and selecting to open a command window(15).

  4. Create 0Dos.bat in a folder and store Cmd inside it so that when you double-click on 0Dos.bat, it opens a Dos Shell window in the folder.

  5. Create 0PS.bat in a folder and store start Powershell inside it so that when you double-click on 0PS.bat, it opens a PowerShell window in the folder.

  6. Assuming that the NIC Utilities are installed, right-click on a file or folder and select Send To-->Shell and it will open a Dos shell in the folder.

  7. Entering PowerShell from a Dos window.

  8. Entering Cmd from a PowerShell window.


3.3 Common UNIX Commands

The following table summarizes the Linux commands I find the most useful. A directory listing of Public\Cmds\UnxUtils will provide the full list of the commands available. A web search will show how to use them.

Table 3.3-I Common Linux Commands

Cmd

Description

Example

find

File name search engine

See wfind

grep

Searches a collection of files for a string

grep -i Hello *.txt

head

Displays the top of a text file.

head file.txt

less

Displays a text file in pages

less file.txt

sed

Performs batch edits on a set of text files

sed 's/unix/linux/' geekfile.txt

sort

Sorts files, usually renamed to wsort

See wsort

tail

Displays the bottom of a text file

tail file.txt

tar

Manages UNIX tar archive files

tar -xvf file.tar

tee

tee reads from standard input and writes to both standard output and one or more files at the same time.

'cmd' | tee -i file.out

touch

Changes a files date stamp

touch file.txt

tr

Translates characters.

cat geekfile | tr "[a-z]" "[A-Z]"

uniq

removes duplicate lines

wsort file.txt | uniq >ans.txt

wc

Counts words, lines, and characters

wc *.c

wfind

Very sophisticated file name search engine. Renamed to wfind to avoid collisions with the Windows find command.

Locate sample.txt: wfind ./abc -name sample.txt

wget

Retrieves files from the web

wget https://pdq/Summary.pdf

wsort

Sort command with many options

wsort file.txt>sfile.txt

xargs

Used to build and execute commands from standard input

echo 'one two three' | xargs mkdir


3.4 Short Synopsis of Cmd.exe

Cmd.exe is the second CLI for Windows. The first one was command.com. Command.com was superseded by Cmd.exe. PowerShell is a more powerful CLI but it also is more verbose and has a more complicated syntax (IMHO). For those reasons I tend to use Cmd.exe, except when the greater power of PowerShell is required. A short summary of Cmd.exe follows. By the way, the help command can be used inside of a Cmd.exe window to obtain information. For example, entering help for inside of a Cmd.exe window will display information on the for command.

Cmd.exe supports parameters. Parameters are labeled %1 through %9. When a parameter is used to hold a path, the various fields may be extracted as shown below. The sample file is: C:\utils\MyFile.txt. Only the first parameter is shown (%1), however the same syntax applies to the other parameters (%2 -- %9) as well.

Table 3.4-II Cmd.exe Parameter Fields

Parm

Description

Example

%~f1

Expands to a Fully qualified path name

C:\utils\MyFile.txt

%~d1

Expands to a Drive letter

C:

%~p1

Expands to a Path

\utils\

%~n1

Expands to a file Name

MyFile

%~x1

Expands to a file extension

.txt

%~1

Expand %1 removing any surrounding quotes (")

 

%~a1

Display the file attributes of %1

 

%~t1

Display the date/time of %1

 

%~z1

Display the file size of %1

 

Basic Control Structures

Typically three commands are used to control the flow of control in Cmd.exe:

If

The two basic forms of the If statement are:
if [not] <string1>==<string2> <command> [else <expression>], and
if [not] exist <filename> <command> [else <expression>]

To check for a null string, Enclose the variable in quotation marks and add a period. For example:
if "%1." == "." goto Null
This tests to see if the first parameter is defined or not. More information on the if statement may be found at Windows If statement.

For

The basic for syntax is:
for %variable in (set) do Command
For example, open a command window and enter:
for %F in (*.*) do echo %F
This lists the files in the folder.
The basic For statement is used to iterate through a set of things. A typical example is:
for %F in (*.txt) do copy %F holding\
This copies all text files in the current folder to the holding folder. When used inside of a batch file, the percent signs are doubled, as in:
for %%F in (*.txt) do copy %%F holding\

More information on the for command may be found at: Windows For statement

GoTo

The GoTo statement is used to transfer control to a labeled line in a batch file. Example:
GoTo Done
 ...
:Done
Labels are alpha-numeric strings starting with a Letter. For more information about the GoTo statement, see: Windows GoTo statement.

Cmd.exe has many subcommands. A web search will disclose their names and usage. The following table contains the most commonly used ones. More information may be found at: Windows Cmd Interpreter

Table 3.4-III Cmd.exe Common Subcommands

Command

Description

CD

Change Directory - move to a specific Folder

Clip

Copy STDIN to the Windows clipboard

Cls

Clear the shell window

Cmd

Start a new Cmd shell

Copy

Copy one or more files to another location

Date

Display or set the date

Del

Delete one or more files

Dir

Display a list of files and folders

Echo

Display message on screen

Exit

Quit the current script/routine and set an errorlevel

For

Loop command

Format

Format a disk

Goto

Direct a batch program to jump to a labeled line

Help

Online Help

HostName

Display the host name of the computer

IF

Conditionally perform a command

IPconfig

Configure IP

Logoff

Log a user off

Move

Move files from one folder to another

Net

Manage network resources

Netdom

Domain Manager

Netsh

Configure Network Interfaces, Firewall & Remote access

Nbtstat

Display networking statistics (NetBIOS over TCP/IP)

Netstat

Display networking statistics (TCP/IP)

NLSInfo

Display locale information (reskit)

Path

Display or set a search path for executable files

Pause

Suspend processing of a batch file

Ping

Test a network connection

RegEdit

Import or export registry settings

Rem

Record comments (remarks) in a batch file

Ren

Rename a file or files

Rmdir

Delete a Directory

RoboCopy

Robust File and Folder Copy

Set

Display, set, or remove session environment variables

Sfc

System File Checker

Shift

Shift the position of batch file parameters

Shutdown

Shutdown the computer

Sleep

Wait for x seconds

SSH

OpenSSH remote login client

Start

Start a program, command or batch file

Tar

Store, list or extract files in an archive

Time

Display or set the system time

Timeout

Delay processing of a batch file/command

TraceRt

Trace route to a remote host

Tree

Graphical display of folder structure

Type

Display the contents of a text file

Vol

Display a disk label

Where

Locate and display files in a directory tree

WhoAmI

Output the current UserName and domain

::

Comment


4 Utilities

For this discussion a utility is a program, or a set of programs (or scripts) working together, to accomplish a single task.

Some utilities rely on other programs to accomplish their task. This type of utility can require an involved installation process. A practical example is an Optical Character Reader (OCR) utility. There are commercial OCR's, but they are a little pricey for the home market. Most scanners come with a good OCR, but it can only be invoked by scanning a document.

It turns out that Hewlett Packard released an OCR program (Tesseract) to the public domain in 2005. It was subsuquently picked up by the open source community and continuing development has been funded by Google. Currently it is available for free on Linux, Windows and Mac OS X. To make it easy to use, I encapsulated the following use cases into shell scripts. These are:

  1. Clip2Pdf -- Clipboard text image to searchable PDF.

  2. Clip2Txt -- Clipboard text image to a text file.

  3. Image2Pdf -- Graphics text image (including tiff, bmp, png, jpeg, and gif) to searchable PDF.

  4. Image2Txt -- Graphics text image (including tiff, bmp, png, jpeg, and gif) to a text file.

  5. iPDF2sPdf -- image PDF to searchable PDF.

  6. iPDF2Txt -- image PDF to a text file.

  7. ImageSet2Pdf -- Convert a set of graphical images to searchable PDF. All files in the folder are assumed to be graphical images and will be converted to searchable PDF. There is one PDF file generated for each file. It is not an error if an image has no convertable text, a PDF version is created anyway -- with no searchable text.

  8. ImageSet2Txt -- Convert a set of graphical images to a text file. All files in the folder are assumed to be graphical images and will be converted to text. All files are merged into a single text file.
    Notes:

  9. Empirically Tesseract OCR performs much better when generating a PDF file than when generating a text file. So normally Clip2Pdf is preferred over Clip2Txt, etc.

  10. The clipboard conversion commands require a pixelated image and not a pointer to an image. Screen capture(16) generates a pixelated image as does copying a region in Paintbrush. Both work well with the Clipboard OCR commands.

  11. The commands may be used to convert graphical image files to PDF even though there is no text in the graphical image -- you just get a PDF image with no searchable text. This is sometimes a convenient way to convert a set of images to PDF.

  12. Windows free app PDF Merger and Splitter, available from the Microsoft store, can be used as a PDF page level editor capable of spitting and combining PDF files.
    Each of these use cases frequently arise in typical work situations. The cases require different setup, even though Tesseract is at the heart of the process. In my view these are multiple utilities rather than one. The utility scripts are written in Cmd.exe with additional help from the following programs:

    Table 4-I OCR Utilities

OCR Utilities

Required Programs

Description

Clip2Pdf

PowerShell, Tesseract

Convert clipboard to Searchable PDF

Clip2Txt

PowerShell, Tesseract

Convert clipboard to text

Image2Pdf

Tesseract

Convert image file to Searchable PDF

Image2Txt

Tesseract

Convert image file to text

iPdf2sPdf

Ghostscript, Tesseract

Convert image PDF to Searchable PDF

iPdf2Txt

Ghostscript, Tesseract

Convert image PDF to text

ImageSet2Pdf

Image2Pdf

ImageSet2Pdf invokes Image2Pdf once for each image.

ImageSet2Txt

Image2Txt

ImageSet2Pdf invokes Image2Txt once for each image. However Tesseract merges the results into a single text file.

Because to install the full set of OCR utilities requires Ghostscript, Tesseract, and the control scripts, installation is split into three parts: one for Ghostscript, one for Tesseract, and one for the NIC commands that control the process. See the NIC utilities for the NIC OCR installation guide.

Note: Ghostscript is free for non commercial users. There is a charge for commercial use. Ghostscript is used to convert image format PDF to Tiff format so that Tesseract can process it. ImageMagick can be substituted for ghostscript to do the conversion from PDF to Tiff. Just change the environment variable that points to ghostscript to point to Imagemagick. It may be necessary to modify the scripts appropriately as well.


5 Applications

Windows comes standard with many useful tools that frequently are ignored. Yet at times they are an efficient way to accomplish many tasks. The following paragraphs cover some of the ways these tools can be used. Table D lists recommended third party apps.


5.1 WordPad

WordPad is a poor mans word processor. It is useful as a text editor and as a way to gather information from multiple sources into a single file.

Figure 5.1-24 WordPad -- Initial Setup



Figure 5.1-25 WordPad -- Adjusting Line Wrap

Gathering Information Across Sources

However it is usually a good idea to first establish the defaults you want. The two usual adjustments are to turn off the extra line spacing and to increase the font size, see figure 5.1-24. The view font size can be controlled using <Ctrl>+<center mouse wheel>. Word wrap is controlled from the view tab, see figure 5.1-25

After setting up WordPad, build up the document by
using a combination of text highlight/copy/paste and image copy/paste. The former is straight forward, just highlight text and copy it into Wordpad using <Ctrl>C/<Ctrl>V (or the equivalent action using a mouse right-click.) To copy an image section of, say a webpage, Press <Windows-key><Shift>S. The screen will darken. Drag the mouse over the desired section while holding down the left mouse button. When the left mouse button is released, the highlighted section is copied as an image to the paste buffer. Paste it into an open WordPad document.


5.2 Notepad

Notepad is surprisingly useful as an "Unformatter." Frequently I encounter situations where I want to remove the formatting from text. A quick way to unscramble the formatting associated with the source is to paste the text into Notepad. This removes all formatting. Then enter <Ctrl>A<Ctrl>X exit. The paste buffer is left with just the plain text.

This technique is also useful in dealing with tables. Paste into Notepad and you are left with plain text.

Another use is to create a rough action log: If you open a text file (*.txt) and put ".LOG" as the first record, Notepad will time stamp the next line each time you open the text file.


5.3 Image Editing

I find MS Paint useful as a quick image editor. One trick is to set the default window size to a very small window, say 100x100. Click Resize under the Home menu tab and set it to 100 x 100, or just grab a window handle and drag it to resize the window. Then when you paste into Paint, the window will be automatically resized to match your image.

A more powerful image editing program is GIMP (GNU Image Processing Program.) GIMP is comparable in power to Adobe Photoshop, but, as are all GNU apps, free. It does take a little study to use effectively.

To grab an image fragment from the screen, use <Windows-Key><Shift>S. Paste it into Paint Then select the sub region you want, or annotate it and either save it as Jpeg or PNG or copy it (<Ctrl>A) and paste it into Wordpad or a word processor.

If you want to save it as text, use Clip2Pdf, one of the NIC OCR utilities.


5.4 Third Party Apps

There are some third party applications that should be in a power user's repertoire. Some of the more important ones are discussed in the following paragraphs.
Additional useful applications are listed in Appendix D.


5.4.1 LibreOffice

LibreOffice is an MS Office compatible office system. The reason why LibreOffice is included in the list of recommendeded applications is because it has a batch mode of operation. This means it can be used in ways that most word processors cannot. For example to convert all HTML files to PDF in a folder, use SendTo-->Shell to open a shell window and then enter:
for %F in (*.html) do soffice.exe --convert-to pdf %f(17)
This will generate one PDF file for each HTML file.

LibreOffice has its roots in StarOffice. StarOffice is commercially available. LibreOffice is a public domain spin-off from it and is still referenced as soffice in batch mode, reflecting its origins.

Notes:

  1. LibreOffice should be added to the system path if it is referenced frequently; otherwise use the full path to LibreOffice so Windows can find it.

  2. There is also a holdover file from MS Dos: Soffice.com. So it is necessary to specify the complete file name (Soffice.exe) to avoid accidentally executing Soffice.com instead. This is because Soffice.com does not run properly under Windows 10.


5.4.2 Python

Python is a scripting language that can be used to extend the capabilities of the Windows' shells. The community is somewhat divided on whether to use PowerShell, Python, Java, or Perl. Personally, I prefer Python.


5.4.3 MS Visual Studio

This is a robust development environment for a host of languages. I find it useful to have it available for when I need a good IDE. There are other IDE's. Have one available for when you need it.


5.4.4 Winmerge

Winmerge is a GUI differencing program, very similar to that available in ClearCase. It is extremely useful in determining differences between source versions.


5.4.5 Macro Editor

Two good macro editors are GNU Emacs (AKA Emacs) and Notepad++. I use both. Emacs has been around long enough to provide a ready solution to many editing problems; Notepad++ uses more modern syntax than Emacs. I find the integration with a spell checker to be easier to use with Notepad++ than Emacs. The choice of editor is highly personal and idiosyncratic.

Notes:

  1. Sometimes you have to manually create %UserProfile%\.emacs\

  2. I usually add a macro to unwrap paragraphs (<ctrl>X<esc>Q and one to map F10 to execute the last macro.My Emacs initialization file is shown in Appendix C.


5.4.6 Aspell

Aspell is a spelling checker that integrates well with Notepad++. It is recommended that you install Aspell in %LocalAppData%\Programs. (Normally you use Aspell itself to install the desired dictonaries.) Once Aspell is installed, you can invoke the spelling checker in Notepad++ by pressing F7.
#

A P P E N D I C I E S



Appendix A - Windows Shell Folders

Windows provides several ways of addressing certain system folders. The way presented here is to use the Shell identifier.
The Shell identifier can be used in Windows PowerShell, Windows CLI (cmd.exe), in Windows Explorer, and in the Windows run menu.
To open one of the following Windows system folders in PowerShell or cmd.exe, use Start shell:'Folder-Id'. To access the folder in Explorer enter Shell:'Folder-Id' in the address bar. To access the folder from the Windows run menu, use <Windows-key>R Shell:'Folder-Id'.

An alternate way to access many of the same folders is to use the System Environment. For example entering %LocalAppData%\Programs in the Explorer address bar produces the same results as entering Shell:UserProgramFiles. Using the environment is sometimes more convenient in writing scripts than trying to access the folders programmatically using the Shell command. The current environment may be seen by entering Set in cmd.exe, or by entering dir env: in PowerShell.
The following table was taken from https://windowsreport.com/shell-commands-windows-10/. Only the roughly 60% of the Folder-Id's from the site are shown herein because the other 40% did not produce meaningful results in my testing. This is not surprising as several years have elapsed since the site was generated and also their table represents a more generalized Windows environment than my testing facility.

Table A-I Windows Shell Folders

Shell Folder-Id

Description

shell:AccountPictures
shell:AddNewProgramsFolder
shell:AppData
shell:AppsFolder
shell:AppUpdatesFolder
shell:Cache
shell:Common Startup
shell:ConflictFolder
shell:ConnectionsFolder
shell:Contacts
shell:ControlPanelFolder
shell:Cookies
shell:CredentialManager
shell:CryptoKeys
shell:Desktop
shell:DocumentsLibrary
shell:Downloads
shell:DpapiKeys
shell:Favorites
shell:Fonts
shell:GameTasks
shell:History
shell:HomeGroupFolder
shell:ImplicitAppShortcuts
shell:Libraries
shell:Links
shell:MusicLibrary
shell:MyComputerFolder
shell:NetHood
shell:NetworkPlacesFolder
shell:OneDrive
shell:Personal
shell:PicturesLibrary
shell:PrintersFolder
shell:PrintHood
shell:Profile
shell:ProgramFiles
shell:ProgramFilesCommon
shell:ProgramFilesCommonX64
shell:ProgramFilesCommonX86
shell:ProgramFilesX64
shell:ProgramFilesX86
shell:Programs
shell:Public
shell:PublicAccountPictures
shell:PublicGameTasks
shell:PublicLibraries
shell:Recent
shell:RecycleBinFolder
shell:ResourceDir
shell:Ringtones
shell:SavedGames
shell:Screenshots
shell:Searches
shell:SearchHomeFolder
shell:SendTo
shell:Startup
shell:SyncCenterFolder
shell:SyncResultsFolder
shell:SyncSetupFolder
shell:System
shell:SystemCertificates
shell:SystemX86
shell:Templates
shell:ThisPCDesktopFolder
shell:UserProfiles
shell:UserProgramFiles
shell:UserProgramFilesCommon
shell:UsersFilesFolder
shell:UsersLibrariesFolder
shell:VideosLibrary
shell:Windows

Account pictures folder
Adds a new program folder.
Accesses AppData folder
Accesses the Apps Folder.
Accesses the Apps updates folder.
Accesses the Cache folder.
Accesses the Common Startup folder
Accesses the Conflict folder
Opens up the connections folder
Opens the Contact folder
Opens the Control panel folder.
Opens the Cookies folder.
Opens the Credential manager feature.
Opens up the Crypto keys folder
Opens up the Desktop folder.
Opens the Documents folder
Opens the Downloads folder
Opens the DpapiKeys folder
Opens the Favorites folder.
Opens the Fonts folder.
Opens the Game Tasks folder
Opens the History folder
Opens HomeGroup folder.
Opens the Implicit Apps shortcut folder.
Opens Libraries folder.
Opens the Links folder.
Opens LusicLibrary folder.
Opens MyComputer folder.
Opens NetHood folder.
Opens NetworkPlaces folder.
Opens OneDrive folder in Windows 10
Opens Personal folder.
Opens PicturesLibrary folder.
Opens Printer folder.
Opens PrintHood folder.
Opens Profile folder.
Opens ProgramFiles folder.
Opens ProgramFilesCommon folder.
Opens ProgramFilesCommonX64 folder.
Opens ProgramFilesCommonX86 folder.
Opens ProgramFilesX64 folder.
Opens ProgramFilesX86 folder.
Opens Programs folder.
Opens Public folder.
Opens PublicAccountPictures folder.
Opens PublicGameTasks folder.
Opens PublicLibraries folder.
Opens up recent items folder
Opens the system Recycle Bin.
Opens up the Resource folder
Opens up the Ringtones folder in Windows 10
Opens the SavedGames folder for the current user.
Opens the Screenshots folder
Opens the Search folder.
Opens the Search Home folder.
Opens the SendTo folder.
Opens the Startup folder.
Opens the SyncCenter folder.
Opens the SyncResults folder.
Opens the SyncSetup folder.
Opens the System folder.
Opens the SystemCertificates folder.
Opens SystemX86 folder.
Opens the Templates folder.
Opens the ThisPCDesktop folder.
Opens the user profiles folder.
Opens Program Files folder.
Opens Program Files Common folder.
Opens the Files folder for the current user.
Opens the Libraries folder for the current user.
Opens Video library folder.
Opens the Windows folder

As an example, typing Start Shell:DocumentsLibrary in cmd.exe opens the documents folder. The same syntax works in PowerShell: Start Shell:DocumentsLibrary. Similarly,
typing Shell:DocumentsLibrary in the address bar in Explorer also opens the Documents folder. And finally, entering <Windows-Key>R Shell:DocumentsLibrary also opens the Documents folder.


Appendix B - Windows Environment

The following table shows the environment variables available in a typical Windows environment. It was generated via the set command on a typical PC. Environment variables can be referenced in scripts and programs. Environment variables are case insensitive. Environment variables are defined using the set command as in Set Abc=def. This defines variable Abc with the value def. There should be no spaces on either side of the equals sign or you will be introducing spaces in the name or value.
Set with no arguments lists the environment variables in Cmd.exe; while the current environment may be seen by entering dir env: in PowerShell.

Table B-I Typical Windows Environment

Environment Variable

Typical Value or Description

AllUsersProfile
AppData
CommonProgramFiles
CommonProgramFiles(x86)
CommonProgramW6432
ComputerName
ComSpec
DriverData
HomeDrive
HomePath
LocalAppData
LogonServer
NUMBER_OF_PROCESSORS
OneDrive
OneDriveConsumer
OS
Path
PathExt
PROCESSOR_ARCHITECTURE
PROCESSOR_LEVEL
PROCESSOR_REVISION
ProgramData
ProgramFiles
ProgramFiles(x86)
ProgramW6432
PROMPT
PSModulePath
PUBLIC
SessionName
SystemDrive
SystemRoot
TEMP
TMP
UserDomain
UserDomain_RoamingProfile
UserName
UserProfile

C:\ProgramData
C:\Users\'User'\AppData\Roaming
C:\Program Files\Common Files
C:\Program Files (x86)\Common Files
C:\Program Files\Common Files
'PC-name'
C:\WINDOWS\system32\cmd.exe
C:\Windows\System32\Drivers\DriverData
C:
C:\Users\'User'
C:\Users\'User'\AppData\Local
\'PC-Name'
Number of Processors
C:\Users\'User'\OneDrive
C:\Users\'User'\OneDrive
Windows_NT
Path-List
Executable Extensions
Processor Manufacturer
level
revision
C:\ProgramData
C:\Program Files
C:\Program Files (x86)
C:\Program Files
$P$G
PS Module paths
C:\Users\Public
Console
C:
C:\WINDOWS
C:\Users\'User'\AppData\Local\Temp
C:\Users\'User'\AppData\Local\Temp
'PC-Name'
'PC-Name'
'User'
C:\Users\'User'



Appendix C - Emacs Initializaion File

To edit the Emacs initialization file, you select Options --> Edit Init file and paste the following data into it. Remember to create %UserProfile%\.emacs first:


;; set F10 as macro execute key
(global-set-key 'f10 'call-last-kbd-macro)

(defun remove-hard-wrap () ;; bound to C-x M-q
"Do the opposite of fill-paragraph; stuff all lines in the current
paragraph .row into a single long line."
(interactive)
(let ((fill-column 90002000))
(fill-paragraph nil)))

(global-set-key "C-xM-q" 'remove-hard-wrap)

If you want to change to a larger font, use Options-->Font Size and then Options --> Save Options to a Custom File


Appendix D - Recommended Applications

The Following table lists some recommended third party applications that can be used to advantage. Most of these are free and in the public domain. This list is not exhaustive, however, it does list my personal favorites.

Table D-I Recommended Third Party Applications

Application

URL

Notes

7-Zip

https://www.7-zip.org/

File/Folder Compress, Encrypt

Aspell

https://sourceforge.net/ projects/aspell/files/latest/download

Spell checker -- integrates with Notepad++

Ghostscript

https://ghostscript.com/ releases/index.html

Displays and converts most image formats

GIMP

https://www.gimp.org/

Image editing program similar to Photoshop

Imagemagick

https://imagemagick.org/

Image format conversion program

LibreOffice

https://www.libreoffice.org/

MS Word compatible word processor

MS Devloper Studio

https://visualstudio.microsoft .com/vs/community/

Standard PC IDE for many languages

Nmap

https://nmap.org/book/inst-windows.html

Displays network connections

Notepad++

https://notepad.plus/

Macro editor

PDFMerge

Available from Microsoft Store (Free)

PDF Page editor. Split, move, and edit pages.

Python

N/A

Just type "Python" in the search box and Windows will install it.

Tesseract-OCR

https://github.com/UB-Mannheim/tesseract/wiki

Public domain OCR program

Winmerge

https://winmerge.org/

Open Source differencing and merging tool for Windowsprojects

Wireshark

https://www.wireshark.org/

Displays network packet traffic

The following applications are optional as alternative programs might suite other people's taste.

Table D-II Optional Third Party Applications

Application

URL

Notes

Adobe Photoshop

https://helpx.adobe.com/ creative-cloud/help/download-install-Photoshop.html

Commercial image editor

Avidemux

http://avidemux.sourceforge.net

Free Video Editor, complements Handbreak

Audacity

https://www.audacityteam.org

Free Audio Editor

Calibre

https://calibre-ebook.com/

Free e-book composer and format converter

Clearcase

https://www.ibm.com/products/ rational-clearcase

Enterprise-grade configuration management system

Dia Diagram Editor

https://sourceforge.net/projects/dia-installer/

Diagram Editor

GNU Emacs

https://www.gnu.org/software/emacs

Macro editor

GNUPlot

http://www.gnuplot.info/ download.html

Portable command-line driven graphing utility

Handbrake

https://sourceforge.net/projects/ handbrake.mirror

Video converter

ImDisk

https://sourceforge.net/projects/ imdisk-toolkit/

RAM Drive

Inkscape

https://inkscape.org

Free PDF and Image Editor

Livelink

http://www.contentmanagementby excel.com/docmanagement.htm

Enterprise-grade document management system

NAPS2

https://www.naps2.com/

Free OCR Software with OCR Capability

MS Word

https://www.microsoft.com/en-us/microsoft-365/word

Standard Office Word Processor

Plex

https://www.plex.tv/

Stream movies on a LAN

Py2Exe

http://www.py2exe.org/

Convert a Python script to an exe

SMPlayer

https://sourceforge.net/projects/ smplayer

Video Player

Irfanview

https://www.fosshub.com/ IrfanView.html

Free image viewer



Appendix E - Preparing for Disaster

Fully securing your system (PC's + Network) is straightforward, if a bit tedious. The following is an outline of how to do it.


E.1 Securing Your PC Against Malware

  • You need an anti Virus app -- Windows Defender (free with Windows) is adequate. Meaning you don't have to do anything here.

  • You need an anti-malware app. The two best that I know of are: Kaspersky and Malwarebytes (MWB.) I use Malwarebytes Premium. (MalwareBytes Privacy is a VPN, which solves a different problem.)

  • You need a cloud backup to recover from a drive failure and ransomware should your PC get infected. AFAIK they are all good. I use I-Drive.

  • An optional procedure you can do is to pull an image copy of your main drive. Then you can recover to your system state at that time by restoring back. This makes for an almost painless recovery from ransomware, but you have to keep cloning your drive to stay current.

  • If you use a Laptop for travel, then it should have a VPN installed so you can access sensitive sites (like banking) without worry. There is now a plethora of VPN's I use ExpressVPN.

  • It is a good idea to encrypt sensitive files such as Tax records. 7-Zip (free) can compress and encrypt files and folders. I use 7-Zip.

  • It is also a good idea to make a list of your installed apps, their proof of purchase, and where to download them from. This is needed to recover from a disk crash or from ransomware. Save this data in the cloud or on an external device (or both.)

  • Write down and save your administrative password and ID. One way is to use a Password Manager and save the credentials for Microsoft -- Cloud, Computers, Apps & Gaming Microsoft's web site.)

  • You should also save a copy of your Window's Product key. One way of displaying it is to open an Administrative Dos Window: Right-click on the Windows icon in the task-bar and choose
    Command Prompt (Admin)
    and paste the following in the window:
    wmic path softwareLicensingService get OA3xOriginalProductKey
    This will normally display the Product ID.

    If the product key is not displayed, then get it from the registry:
    Enter <Windows-key>R regedit (confirm you want to launch it)
    This will launch the registry editor, then paste the following key into regedit:
    Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform

    The value of BackupProductKeyDefault is a valid product key.
    This concludes securing your PC to protect against malware including ransomware and drive failure.


E.2 Securing Your Network

This is discussed in section 1.7-16.


E.3 Extras

  1. Advanced security includes whole disk encryption, such is available by using Bitlocker. Bitlocker is available under Windows Pro. What it does is encrypt your entire disk. So if your PC is stolen your data is protected. It does not protect your data against malware. This is because in order to use your disk, you have to unlock it. If malware breaks in while your disk is unlocked, your data is vulnerable. For that reason, it is wise to encrypt sensitive data even if you are using whole disk encryption.

  2. Use a password manager to remember your passwords.

  3. You can also use a RAM disk to edit encrypted documents. That way there is no unencrypted deleted files/file remnants left on your disk.

  4. It is a good idea to have an Uninterruptible Power Supply (UPS) to protect against power failures. I color code my power cables, one color for protected and a different color for unprotected. That way I don't waste my UPS on lighting, for example.

  5. You can optionally stop USB's and DVD/CD's from automatically executing commands when they are activated. File Autorun.inf is automatically executed on insertion/activation. MWB/Kaspersky should catch misuse, however you can manually change the default to Ask me every time by entering Autoplay in the search window, clicking on Autoplay Settings, and changing the defaults to Ask me every time.

  6. You can disable the ability for PDF files to execute JavaScript. It turns out that PDF files can contain executable JavaScript. MWB/Kaspersky should stop it from doing bad things, but I like to disable it anyway. Open any PDF file. Click Edit-->Preferences and disable JavaScript:For example Adobe Reader DC, a common PDF reader, supports embedding Java Script in PDF files. This means that a rogue PDF file can install malware. A good virus checker normally will detect this, but just to be sure, I always disable Java Script in Adobe Reader DC:

   a. Open any PDF file

   b. Click File-->Edit as shown in figure E.3-26

   c. Disable Java Script as shown in figure E.3-27

Figure E.3-26 Editing PDF preferences



Figure E.3-27 Disabling Java Script

  1. You can add extra protection by using a local backup. This is an App that copies your data (possibly your e-mail if you save it locally) to a separate drive. I have mine setup to run every time I start my PC. Other possibilities are to use the Windows scheduler to schedule a daily backup (or both.) The local backup provides protection if your cloud backup fails. It is also provides a much faster recovery than a cloud backup. (Cloud recovery, in my experience, is rather slow. Also I don't want my highly volatile e-mail included in my cloud backup.) A simple backup is available for free from SourceForge as part of Windows Power Utilities (which I wrote and donated to the public domain.) See:https://sourceforge.net/p/windows-power-utilities/wiki/Install_Backup_Utility/

A local backup relies on the physical security of the PC, i.e. it is not usually encrypted. However, you can modify the script to use 7-Zip and specify the password as part of login if encryption is desired.

F O O T N O T E S



(1) 
A Software Utility is an App that is designed to help analyze, configure, optimize or maintain a computer and enhance the computer's performance.

(2) 
Pressing <windows-key>X opens the Quick Access Menu</windows-key>

(3) 
If the taskbar doesn't display, press the Windows-key

(4) 
Ping is part of the Internet Control Message Protocol (ICMP)

(5) 
Executor is a launcher program provided with the NIC Utilities

(6) 
More on shells later

(7) 
Strictly speaking, it may be argued that the proper term is GNU/Linux because of the intimate connection between Linux and the GNU project.

(8) 
I am approaching the choice of language from the standpoint of enhancing the usability of a PC and not considering hosting websites or other uses.

(9) 
Large factions may be found promoting Perl, Java, c, C++, and C# as well.

(10) 
Saved Cmd.exe scripts are sometimes referred to as batch mode.

(11) 
SourceForge is a large repository of vetted free software.

(12) 
It should be mentioned that wget is a little out of date. If the UnxUtils version doesn't appear to work correctly, try the Linux shell version under WSL.

(13) 
For W11, right-click on a folder and select New Window.

(14) 
In W11 the shift key may be omitted.

(15) 
If WSL is installed, you may also open a Linux Shell.

(16) 
<windows><prt-scn> captures the entire screen; <windows><shift>S captures a region; <alt><prt-scn> captures the active window.</prt-scn></alt></shift></windows></prt-scn></windows>

(17) 
If soffice is not in the current path, use ``C:\Program~Files\LibreOffice\program\soffice.exe''.

I N D E X

ACL

Notepad++

Adding Cmds to the Public folder

OCR

Appdata folder

Opening a shell window

Aspell

Organizing your desktop

Batch mode

Paintbrush

c

Path

C#

PC

Changing icon

PC name

Changing icons

Perl - X.001 X.002

CLI shell

Photoshop

Cloud backup

ping

Cmd.exe - X.001 X.002

Powershell - X.001 X.002

Cmd.exe parameters

Private network

Cmds folder

Public folder

Common startup folder

Python - X.001 X.002

Context menu

Ransomware

Desktop toolbar

Registry

DHCP

Screen images folder

Display environment variabes

sed

Documents folder

Sendto folder

Dos shell

SendTo special folder

Downloads folder

Shell.bat

Editing PDF files

Shortcuts

Emacs

sort

Environment

Start menu

Executor

Startup folder

Explorer

Subdirectories

Favorites folder

System environment

File naming conventions

System path - X.001 X.002

Files

tail

find

tar

Firewall

Task Manager - X.001 X.002

Folder sharing

Taskbar

Folders

Taskmgr

GIMP

tee

GNU Emacs - X.001 X.002

Tesseract OCR

GNU/Linux

touch

grep

tr

GUI shell

UNC

hesd

uniq

Home folder

UNIX

IBM PC

wc

Java - X.001 X.002

Web shortcut

Junk folder

wfind

Launcher program

wget

Legacy programs

Windows environment

less

Windows Registry

Libreoffice - X.001 X.002

Windows shell command

Linux

Winmerge

Locating programs

WordPad

Malware

wsort

MS Visual Studio

WWW

MS Word

xargs

Notepad

 


Related

Wiki: Home