Doing MS Windows

Code quality and Windows ME
Sheldon Cooper to Bill Gates: ‘Maybe if you weren’t so distracted by sick children in Africa, you could’ve put a little more thought into Windows Vista.’ (The Big Bang Theory)

1. Articles about Microsoft practices

2. Interface tips

This section contains items related to various versions of Windows, some very old. Some of the older items may still be relevant.

The terms ‘folder’ and ‘directory’ are used interchangeably here, as are ‘Windows Explorer’ and ‘File Explorer’.

2.1 Windows 11

Windows 11 introduces a number of counterproductive changes to the Start menu and task bar. Third-party solutions are available (ref).

2.2 Changing date and time formats

The obvious way to change the date and time formats may be Settings ► Time & Language ► Date & time ► Date, time & regional formatting ► Change data formats, but the format choices are limited. Instead of Change data formats, go to Additional date, time & regional settings ► Change date, time, or number formats ► Additional settings… and select either the Time or Date tab. MMM gives a 3-letter month abbreviation and MMMM gives the full month name.

In Wndows 11, do Settings ► Time & language ► Language & region ► Administrative language settings ► Formats. However, the time in the bottom-right corner doesn’t show seconds even if both the Short time and Long time formats are H:mm:ss.

2.3 PowerShell vs. regular Command Prompt

In Windows 10, whether PowerShell or the regular Command Prompt appears in the menus is determined by Settings ► Personalisation ► Taskbar ► Replace Command Prompt with Windows PowerShell ….

2.4 Changing mouse-cursor appearance

To change the appearance of the mouse cursor in Windows 10, go to the home page of Settings and select Devices then Mouse. Click on Additional mouse options then select the Pointers tab. Highlight which mouse usage you want to affect (e.g., Normal Select) then click on Browse… and look for the .cur or .ani file that you want to use. (The default pointer files are in C:\Windows\Cursors\.) You can save the setting as a new Scheme.

For a public-domain mouse-pointer image that looks like a laser pointer, download Laser Beam Normal.cur.

2.5 Making Hibernate appear in menus

By default Hibernate doesn’t appear in the Start ► Power menu or in the Start-X ► Shutdown menu. To add it, go to Settings ► System ► Power & Sleep ► Additional power settings ► Choose what the power buttons do, click on Change settings that are currently unavailable, and then check the box Hibernate / Show in Power menu.

2.6 Disabling touchpad

To disable the touch pad when a mouse is connected (e.g., when working on a laptop with a cat washing herself in one’s lap), go to Settings ► Devices ► Touchpad and deselect Leave touchpad on when a mouse is connected. If using a wireless mouse, it’s not enough to turn the mouse off in order to activate the touchpad, the USB wireless receiver must also be disconnected.

2.7 Screenshots

In Windows 10 and 11 (and earlier?) the fastest way to take and save a screenshot is Start+prt sc. It saves an image of the entire screen in Users\username\Pictures\Screenshots.

In Windows 11 (and earlier?) another method is the Snipping Tool: Start+Shift+S. This allows selection of the part of the screen to be saved, copies it to the Clipboard, and also allows editing and saving to a file.

2.8 Special characters

One alternative to the old Windows Character Map is Character Map UWP by Edi Wang et al.

2.9 Environment variables

To set environment variables in Windows 10, Settings ► System ► About ► System info ► Advanced system settings ► Advanced ► Environment Variables. Select the environment variable to be edited (e.g., the PATH system variable) and click on Edit. Unlike Windows 7, Windows 10 displays an editable list of individual items rather than just a long text string.

2.10 Event viewer

Start ► Windows Administrative Tools ► Event Viewer may give insight into what’s going on.

2.11 Failure to eject an external device

If Windows claims that a USB device is busy when you try to eject it, Event Viewer might show a Warning with Event ID = 225 (Kernel-PnP), with a detailed message that includes the executable name and process ID of the process preventing the ejection.

For example, MsMpEng.exe, part of Windows Defender, may be scanning the device. One can then do Settings ► Update & Security ► Windows Security ► Virus & threat protection ► Manage settings and add an exclusion (drive letters are treated as folders) or temporarily turn off real-time protection. It didn’t work for me to add an exclusion for a drive that I think was already being scanned, and the GUI doesn’t seem to allow adding a path or folder (or drive) that doesn’t exist yet. It is possible to do that in PowerShell as Admin with a command like
Set-MpPreference -ExclusionPath d:\
It’s also possible to do
Set-MpPreference -DisableRemovableDriveScanning 1

2.12 Start menu

In Windows 11, the user has less control over the display of pinned applications in the Start menu than in Windows 10. The icons cannot be resized and, by default, only 3 rows of pinned applications can be displayed, along with 3 rows of Recommended applications and files. (‘Recommended’ seems to really mean ‘Recent’.) As of build 22509 (still only available to Windows Insiders as of 2022 Jan 22) the number of pinned applications can be changed to 2 or 4, with the total number of rows still fixed at 6.

In Windows 10 & 11, to add a .exe file to the Start Menu, drag it to C:\Users\username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs and press Ctrl+Shift before dropping it, in order to create a link. In Windows 11 this will put it in the Recommended section; one can then right-click on the icon and select Pin to Start.

In Windows 7, there is a Start Menu item in C:\Users\username\ but it is just a shortcut and ‘Access is denied’. The real folder is in C:\Users\username\AppData\Roaming\Microsoft\Windows\. There is also a Start Menu item in C:\ProgramData\Microsoft\Windows\. I don't understand the relationship. Items that have been pinned to the Start Menu are found in C:\Users\username\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu. Dragging a folder into this location doesn't accomplish anything. I was hoping to get something like the way the pinned Firefox item expands to multiple Tasks.

2.13 Programmes that fail

If a programme (e.g., an installation programme) fails when you run it by double-clicking on the .exe in a directory listing, try right-clicking on the .exe file and selecting Run as administrator. You can also try selecting different Compatibility modes.

2.14 32-bit or 64-bit?

To tell whether a .exe or .dll file is 32-bit or 64-bit, open it in a text editor. Near the beginning there will be the letters PE (standing for ‘Portable Executable’) followed by two null bytes. They will be followed by the bytes
#x4c and #x01 (which will appear as ‘L’ and something else) for a 32-bit file; or
#x64 and #x86 (which will appear as ‘d’ and something else) for a 64-bit file
(e.g., ref, ref).

To tell whether a .exe file is 32-bit or 64-bit, you can also right-click on it, select Properties ► Compatibility and check the available Compatibility modes. If the list starts with Windows 95, the executable is 32-bit. If the list starts with Windows Vista, the executable is 64-bit.

Various Web pages describe these tricks as well as methods using the Task Manager or downloaded tools.

Note that, on a 64-bit system, 64-bit .exe and .dll files are in the directories \Program Files and \Windows\System32,
while 32-bit files are in the directories \Program Files (x86) and \Windows\SysWOW64.
The apparently backward names System32 and SysWOW64 are historical debris: System32 was carried over from 32-bit systems to 64-bit systems for the sake of backward compatibility, and SysWOW64 was named after WOW64 (Windows (32-bit) On Windows 64-bit).

2.15 Disabling media view in Windows Explorer

By default, a folder containing media files (music, etc.) will be displayed with columns for title, artist, etc. and no date or file size. To prevent this, right-click on the folder, click on Properties, select the Customize tab, in the Optimize this folder for drop-down list select General Items, check the Also apply this template to all subfolders box if desired, and click OK.

2.16 Disabling group-by in File Explorer

At some point, Windows 10 introduced a group-by function in File Explorer, and it is turned on by default in some directories. To disable it for a directory, right-click in an empty area in the display of the directory contents and under Group by select (None). The latter won’t appear unless grouping by something has been enabled in that directory.

2.17 Date in Windows Explorer

The Date column displays the earlier of the creation and modification dates, or the date from the EXIF header in a JPEG file, or … (ref). The Date created and Date modified columns can be enabled by right-clicking on the column-title bar.

2.18 Executing a shortcut from the command line

A shortcut to a file can be created by clicking and dragging with Ctrl+Shift. Such a shortcut can be used to run an executable file from the command line by adding .lnk to the name of the shortcut in the command. For example, in C:\path2\ create a shortcut called exec that links to C:\path1\executable.exe, and then run executable.exe from the command line by giving the command C:\path2\exec.lnk. You may want to right-click the shortcut file, select Properties and then Shortcut, and clear the Start in field, so the effective current directory when started is the one from which it was run.

2.19 Mapping a drive from the command line

If the Command Prompt is run as administrator, mapped drives (e.g., to an external disk) won't be defined. They can be defined from the command line using a command like
net use w: \\storage-cf25\publicWhen I use dir on the command line to list the contents of a directory on a drive mapped to an external disk, the dates and sizes show but not the filenames. If I use dir /x then the filenames show up. However, I can't run a programme that is in the directory by giving its filename. The filenames show up correctly in Windows Explorer and I can run the programme from there. (cf. similar problem, 2010 May 25

2.20 Creating self-extracting archives

Windows (starting from XP) contains a utility called IExpress for creating self-extracting archives but it doesn’t seem to be accessible through menus. Search for ‘iexpress’.

2.21 Device removal, or not

(2012 Jun 3) When I connect my Sony H5 camera to my Windows 7 computer, it appears as a Removable Disk with a drive letter under Devices with Removable Storage, and the Safely Remove Hardware and Eject Media icon appears in the taskbar. However, when I connect my Canon A1000IS camera, it appears under Portable Devices with no drive letter, and the safe-removal icon does not appear. This means that for some reason it does not need to be, and cannot be, ‘ejected’ before removal.

(2012 Jun 3) Another variant is that when I insert an SD memory card into the computer's card-reader slot, it appears with a drive letter under Devices with Removable Storage but the safe-removal icon does not appear. Right-clicking on the device shows an Eject menu item that can be used for safe removal.

(2021 Sep 11) When I connect my Samsung cell phone to my laptop using a USB-C cable, it will (may?) start charging through the cable. There's a battery-charging icon at the top. If I swipe it down, 'silent notifications' appear: 'Android System USB for file transfer' and 'Settings Cable charging'. Tapping on the former opens it up and 'Tap for other USB options' appears. The settings give a choice between controlling USB by Connected device or This phone; and between different uses for USB, including Transferring files, Charging phone only, and others. When transferring files, the phone appears as a directory in File Explorer, with no apparent method to remove the device safely. Changing to Charge phone only seems to be a way of disconnecting safely.

2.22 Clicks

Under certain circumstances (possibly related to the installation of IE 5), certain versions of Windows will emit a Click sound when Windows Explorer is used to open a new directory, or when a link is selected in IE, or when a Web-page frame is refreshed (perhaps repeatedly but invisibly). If this clicking irritates you, disable the Start Navigation sound under Start Settings Control Panel Sounds Windows Explorer.

2.23 Variable menus

In Windows 2000, by default, menus change their contents depending on which items you've used recently. This means that menus are unpredictable, and that it's more difficult to get at seldom-used features. Microsoft calls these ‘personalized’ menus and considers this to be an accessibility feature. To turn it off, go to Start Programs Accessories Accessibility Accessibility Wizard. Click on Next until you get to the Display Settings dialogue box. (You'll have to pass through a Text Size dialogue box which may go crazy for a while messing with your screen fonts.) Make sure the Disable Personalized Menus box is checked. Click on Next as often as necessary, ignoring a stupid No Options Selected warning.

That was for Windows itself. For Word, do Tools Customize Options and make sure the Always show full menus box is checked.

2.24 Accelerator-key underlining

Starting with Windows 2000, by default the underlining of keyboard accelerators is hidden until the Alt key is pressed. This behaviour can be controlled by going to Control Panel Display Appearance Effects and checking or unchecking the box labelled Hide underlined letters for keyboard navigation until I press the Alt key. This also applies to the visibility of focus rectangles. (References: details and comments; rationale)

2.25 Moving paging file to a different drive

To move the system paging file pagefile.sys from C: to another drive under Windows 7, go to Control Panel ► System ► Advanced system settings ► Advanced ► Performance: Settings ► Advanced ► Virtual memory: Change. Uncheck Automatically manage paging file size for all drives. Select C: and set No paging file, or define a small custom-size paging file (e.g., Initial size = Maximum size = 500 MB) just in case; click on Set. Select the drive where you want the paging file to reside and set System managed size; click on Set. The computer must be rebooted for the settings to take effect.

2.26 Keyboard mapping

Editing value of Scancode Map It may be desirable to swap the Control key and the Caps Lock key, so the Control key (heavily used in Emacs, for example) is positioned to the left of the ‘A’ key and is easier to reach. You can make the swap by editing the Windows registry.

Note that editing the registry is very dangerous. Before editing it you should back it up by doing Registry Export registry file.

To edit the registry, do Start Run regedit. In regedit select the key HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Control\ KeyBoard Layout. Do Edit New Binary Value, give it the name Scancode Map, then use Edit Modify and give it the value

    00 00 00 00 00 00 00 00
    03 00 00 00 1D 00 3A 00
    3A 00 1D 00 00 00 00 00
where the first 8 00's constitute a header, the number of map entries is 0000003 (including the final null entry), 001D is mapped to 003A, and 003A is mapped to 001D. The entries are in reverse byte order.

Reboot for the key swapping to take effect. Note that the swapping will apply to all users.

3. Installation tips

3.1 Large disks

When installing Windows NT on a machine with a large hard disk, only 8 GB of disk space will be recognized, even though the CMOS settings recognize more. Go ahead and install Windows with a system partition of 4 GB (the maximum). Once Service Pack 5 (or 4) has been installed, the system will recognize the whole disk, and Disk Manager can be used to define a partition (or partitions) for the rest of the disk.

3.2 Plain-text passwords

After a new Windows NT machine has been installed (or Windows NT has had to be re-installed on an existing machine), it is necessary to enable plaintext passwords, in order to permit access to Samba on Unix/Linux machines (e.g., Funsan and Fundus). This is done by using the Registry Editor to set the key
\SYSTEM\CurrentControlSet\Services\Rdr\Parameters to
EnablePlainTextPassword REG_DWORD 1 (See MS Support page.)

Under Windows 2000 this can be done by doing Start Settings Control Panel Administrative Tools Local Security Policy. In the Local Security Settings dialogue box, select Local Policies Security Options, double-click on Send unencrypted password to connect to third-party SMB servers and enable it. Apparently a reboot is then required. (Note that the instructions for finding Administrative Tools are incorrect on the relevant MS Support page: they say to use Programs rather than Settings Control Panel.)

3.3 Printers

Under Windows NT, to print using the network printers, HP Jet Admin software must be installed on each machine. It can be installed from \\milsum\download\system\hp\jetadmin\3.4\hpjanten.exe. Running the self-extracting executable (choose an appropriate destination directory rather than using the default) will create several directories called Diskn. In Disk1 run Setup.exe. Once it has been installed, add a printer by doing Start Programs HP JetAdmin Utilities Add HP JetDirect Printer . Use Easy setup and click Next as required. Protocol will be TCP/IP; use the Printer List and select printer for the printer in the hall opposite room 311, and select the driver for HP LaserJet 4Si/4Si MX PS.

Under Windows 2000, HP Jet Admin is not required. (In fact I got an error message when I tried to install it, although it continued to install itself and pretended to work.) To gain access to a remote printer, do Start Settings Printers Add Printer. Specify that it will be a Local printer even though it won't, and make sure the check box Automatically detect and install my Plug and Play printer is not checked. Create a new port, of type Standard TCP/IP port, with the appropriate TCP/IP address. Specify the appropriate manufacturer and printer type.

R. Funnell
Last modified: 2022-01-25 20:48:05