TechByter Worldwide

Listen to the Podcast


12 Feb 2021 - Podcast #730 - (24:42)

It's Like NPR on the Web

If you find the information TechByter Worldwide provides useful or interesting, please consider a contribution.

PayPal

Subscribe

12 Feb 2021

Some Forty-Year-Old Technology Is Still Useful

Those who are old enough to remember computers that ran DOS or CP/M will also remember, and perhaps fondly, batch files that could be used to automate repetitive tasks.

Apple's original Macintosh introduced the graphical user interface to the general public in 1984. Microsoft introduced a graphical user interface with Windows version 1.0 a year later, but Windows wasn't really useful until Windows 3 arrived in 1990. Even then batch files continued to be used a lot until 1995 and Windows 95. Even if your use of computers dates back to the 1980s, you may not have seen a command line since sometime in the 1990s.

And, by the way, Apple didn't invent the graphical user interface. Most of the credit for that goes to Xerox PARC, the Palo Alto Research Center.

The command line is still there; so is a newer option called PowerShell, and you even have the option to use Linux on a Widows 10 computer, which gives you access to the bash command line. Bash (Bourne again shell) replaced the Bourne shell on Linux. Linux developers like to play with words.

With all those choices, I wondered if batch files might still be able to do something useful even in today's GUI world.

 Click any small image for a full-size view. To dismiss the larger image, press ESC or tap outside the image.

TechByter ImageAfter the advent of hard disks in personal computers, starting programs involved using a CD command to switch to the appropriate directory and then typing the name of the program. Could I create a menu using a batch file? It turned out that I could. There weren't a lot of programs to run, so the batch file displayed a numbered list of applications. To start a program, I typed the number associated with it on the menu and pressed Enter. The batch command then changed to the appropriate directory, launched the program, and opened again when I closed the program.

As recently as 2010, SevenForums, a help site for Windows 7, was still showing users how to create a menu file using a DOS batch command. >>>

Back then, it was one program at a time. If I wanted to use Lotus 1-2-3, I had to close WordPerfect. Having a batch file that ran the menu saved a lot of keystrokes, and probably a lot of typos, but nobody needs a menu that relies on a batch file today. But maybe you need something else that a batch file can do. Let's take a look.

I am a fan of backups. A good backup strategy virtually eliminates the possibility of losing important files. "Virtually" because some unforeseen failure could still arise. But if you keep copies of files in several locations, the risk is reduced to some exceedingly small non-zero value. By "several locations" I mean on your computer, on a backup drive that's connected to the computer only when you're backing up files, and in the cloud. Might the command line and a batch file be helpful?

Let's see.

Old DOS users will remember Copy and XCopy. The first was used to copy small groups of files and the second was used to copy files and directories. Now there's Robocopy, which is a more powerful version of XCopy, which it is intended to replace.

The help file for Copy is 28 lines long, indicating its basic capabilities. It "copies one or more files to another location" according to Microsoft.

XCopy's help file is 61 lines long and Microsoft's description says that it "copies files and directory trees".

If "Robocopy" makes you envision a robot doing the copying, you're not alone; but that's not what it means. Robocopy is short for "robust copy", and yes, there does seem to be an extra O in there, but somebody probably thought "RobCopy" to be a poor choice for a name. In any event, Robocopy's description in the help file reveals its capabilities: "Robust File Copy for Windows". The help file is a little over 190 lines.

Robocopy has enough features that it can serve as a backup utility for someone who doesn't want to buy a utility such as GoodSync. It requires more work to set up than a utility like GoodSync does and it doesn't have all the features that GoodSync offers, but it's free.

Robocopy can be used to mirror directories in addition to its ability to copy, move, or archive files. It can be set to copy only new or changed files. It honors the archive bit. Because of the mirroring option, the first backup will take longer than subsequent uses. Robocopy can even be set to watch a directory for changes and then to copy files that have changed.

Backing Up The User Profile

TechByter ImageLet's say that you want to back up your Windows user profile. This directory should already be backed up if you're using an application such as Code 42's Crash Plan. Although this application cannot be used to back up the Windows directory, Program Files, Program Files (x86), and a few other directories that contain rapidly changing files, it will back up the Users directory and that will include your user profile. Also, if you use an application by Microsoft or a third party to create an image of the system, the user profile will be there.

Perhaps you'd like to have an additional copy of this directory because it contains important data. By default, data from most applications will be stored in the user's profile. That's not the case for me because I have data directories for various applications on other drives, but there's still information in the user profile directory that I don't want to lose. Maybe using Robocopy would be a good way to accomplish this.

TechByter ImageI could use an application such as QDir, or even Microsoft's File Explorer, to copy the Users directory to my Local Backup drive. That's not a good option, though — especially if all of the data files are there. That's because there is no way to tell the application to copy only new or modified files. If the first copy takes 30 minutes, every subsequent copy will take 30 minutes. Robocopy addresses that issue.

Here's the command that can be used to back up a user profile:
Robocopy "C:\Users\willi" "Y:\UserProfileWilli" /mir /xa:sh /xd AppData /xjd /r:5 /w:10 /mt:32 /v /np /log:ProfileBackup.log
When you run the program, it's important to do so from a directory where your user has write privileges. I used a directory called "_TEMP" on drive D. Let's look at each piece of that long command in order:

Opening the command prompt and typing Robocopy "C:\Users\willi" "Y:\UserProfileWilli" /mir /xa:sh /xd AppData /xjd /r:5 /w:10 /mt:32 /v /np /log:ProfileBackup.log every time you want to backup the user file is both tedious and and error prone. That's where batch files finally enter this picture.

You could create a file called ProfileBackup.bat (or ProfileBackup.cmd) and save it in a directory where you have write permissions. Then you'd only need to navigate to the directory and double-click the file name. To keep the process organized, you might put the file in its own directory. I created a directory called ProfileBackup on drive D and moved ProfileBackup.cmd and ProfileBackup.log there.

Creating a shortcut for the command file on the desktop would make the process even easier, but it would still depend on you to remember to run the file. To automate the process, you could create a job in the Task Scheduler so that it would run when you want it to, perhaps daily at 3pm. Here's how.

TechByter ImageWhen the command is running, a command window will open briefly and then close. Adding a few lines of text above the command that runs Robocopy will let the user know what's happening. If there are no (or only a few) files that need to be copied, the windows will open and then almost immediately close. In this case, you've created the file and set it to run daily, so it's unlikely that this will be seen as ominous, but it would still be better to eliminate confusion.

So far, I've added five lines above the Robocopy command:
@echo off
echo ############# Profile Backup #############
echo Backing up your Windows profile directory.
echo Please wait. This window will close when the process is complete.
echo ##########################################

The @echo off line ensures that Windows does not display commands as they are executed, and the @ sign in front of the command keeps Windows from displaying the line that tells it not to display commands. The four echo lines followed by text will display that text for the user to read. To ensure that the user sees the information, all that's needed is a couple of lines of code below the Robocopy command:
echo The process is complete.
timeout /t -1

The timeout command tells Windows to wait for the amount of time specified by the /t switch. Time is specified in seconds, so /t 5 would display the message for five seconds and then close the window. By specifying /t -1 I've told Windows that it should keep the window open until the user presses a key. The timeout command also autotmatically displays "Press any key to continue..."

To find out what other useful functions you might be able access via the command line, look through reference materials from Microsoft and others. Just because some of the technology is forty years old doesn't mean it's no longer worth using. Working with batch commands can be both useful and amusing. If you find DOS commands and batch files amusing, though, you're in the same sorry boat I'm in. But we have references for that!

References

Short Circuits

Improving TV Sound With New Speakers

Although I watch very little television, I do watch a lot of motion pictures on DVDs. The television, a Samsung model that I bought in 2014, has decent speakers, but dialog can be a problem. Recently I found a solution.

The problem became more acute when I started watching "new" Doctor Who episodes, starting from when the program returned to the air in 2005. The episodes have complex, cinematic sound tracks that are busy with music and foley effects. Additionally, the actors are British so I have to deal with the accents and with the occasional odd words that are perfectly normal in British English, but less so in American English.

Add my ears to those challenges. They're not getting any younger and, although they worked well four or five decades ago, they're somewhat deficient now.

TechByter ImageSeveral manufacturers make speakers that connect to televisions via the optical sound port. The Bose TV Speaker is modestly priced, at least for Bose, that gets poor reviews from those who are seeking a theater sound system. Fortunately, it gets good reviews from those who are simply seeking to make dialog clearer.

It's a relatively easy audio trick. Dialog occupies mid-range sounds. People can hear sounds from about 20Hz to 20,000Hz. Women can usually hear sounds above 20,000Hz. Long ago, so could I; but not now. By itself, that's not a problem. The most important sounds for intelligible speech are between 500Hz and about 8000Hz, with the most critical part of the spectrum between about 2000Hz and 4000Hz.

So probably it was relatively easy for Bose engineers to create a circuit that boosts those essential frequencies. That makes the low frequencies, which are important for sound effects appear to be quieter and highlights the dialog.

Switching between normal sound and enhanced speech is accomplished with a single button press on the remote. The Bose TV Speaker produces sound that's marginally better than the television's built-in speakers, but the ability to make speech more intelligible is a huge improvement.

Spare Parts

Keep The Taskbar Tidy

If you have a lot of programs open simultaneously on a Windows PC, the Taskbar can fill up. This is even worse if you pin a lot of icons to the Taskbar, which is what I do. Removing Microsoft's default icons can clean up the Taskbar if you don't need them.

I think of the Taskbar as high-value real estate, so I remove anything that I don't use regularly. Microsoft makes it possible to do this because the developers understand that not everyone wants to use the computer exactly as it arrived.

The Taskbar serves as a Start bar for me. All of the programs that I use regularly are there, all 112 or so of them. Granted, some of these applications are used rarely and I've set the Taskbar to have two rows of icons and to use small icons.

TechByter ImageThe first thing I remove is the Search button that's at the right of the Start button because I never, ever search that way. I also remove the Cortana button because I don't use Cortana. I don't want the Task View button because there's as easy keyboard shortcut to open Task View. I don't the People icon, either. It would be displayed left of the Notification area. My primary computer doesn't have a touch screen, so I don't need the Ink or Keyboard buttons.

Next, I click Taskbar settings and lock the Taskbar so I don't change its size by accident and turn off options that would hide the Taskbar. To conserve space, I choose small Taskbar buttons.

Then it's time to scroll down to the Notification area section and click Select which icons appear on the Taskbar. You may find more than a dozen options here, so select the most important icons to display there. You can also enable or disable various system icons (clock, volume control, location, power, and such).

What To Do When A Secure Digital (SD) Card Says It's Write Protected

If you've ever had a computer tell you that a an SD memory card is "read only" or "locked", here's what to look for. Usually, it's a quick and easy fix.

TechByter ImageStart by looking at the SD card to see if the write-protect switch is in the lock position. If it is, just slide it to the other position and try the card again. This will fix the problem most of the time, but there are other possibilities.

Try blowing compressed air over the contacts. Using your breath isn't a good choice because of the high humidity and (as we all know thanks to Covid) the small droplets that we all exhale. If cleaning the contacts doesn't work, try cleaning the card reader by using a vaccuum cleaner.

If you're still stuck and you have another SD card handy, try it. If one card works and the other doesn't, there's something physically wrong with the card. If neither works, it could be the card reader, so try a different one if you can.

Before giving up on the card, try rebooting the computer.

Twenty Years Ago: Another Visual Basic Scripting Attack

VBS scripting ploys were common in 2001, and I wrote about the importance of common sense in avoiding traps: "Chances are most company presidents and managers won't send you a message with a picture of Anna Kournikova, especially in a message with a little smiley face. If you get something like that, alarms should be going off."

I suggested two rules that still work today: