Windows XP and Advanced Command Line Utilities

Both Windows Command-Line Administration Instant Reference and Administering Windows Server 2008 Server Core contain a number of advanced commands, such as SetX, that don’t come with the operating system. A number of readers have written to ask about these commands and where they can get them. Fortunately, Microsoft makes it easy to get what you need by downloading and installing the Windows XP Service Pack 2 Support Tools.

The Support Tools site contains a list of the commands and utilities you get. Included in this list are two important MMC console configuration files (ADSIEdit.msc and SIDWalk.msc) that make management tasks considerably easier. There is an executable form of ADSIEdit, but Support Tools doesn’t include it and you can’t use ADSIEdit as a command line tool anyway. The SIDWalk utility comes in executable (.exe) form as well so that you can use it in batch files.

In order to install the Support Tools, you must provide 5 MB hard drive space. Of course, coming up with that small amount of space isn’t the problem it once was. You must also have Windows XP Service Pack 2 (or higher) installed.

 

Something that Microsoft doesn’t emphasize is that these tools don’t work with the 64-bit version of Windows XP. Unfortunately, I haven’t found a workaround for the problem. Utilities created for newer 64-bit versions of Windows, such as Windows 7, don’t appear to work with Windows XP. If someone has a solution to this problem, please let me know.

After you download Support Tools, you may have to add a new path to your Windows setup. You perform this task using the Environment Variables dialog box. Simply open the System Properties applet, select the Advanced tab, and click Environment Variables to access it. Make sure you add the path to your installation to the existing Path and don’t overwrite the existing path with the new information. (Highlight the Path entry in the System Variables list and click Edit to display the Edit System Variable dialog box.) In most cases, the Support Tools install to the %Program Files%\Support Tools folder, which means you’d type ;%Program Files%\Support Tools at the end of the existing Path environment variable.

I’ll provide updates to this post as needed. If you have any questions, please contact me at [email protected].

 

Exoskeletons Become Reality

It wasn’t very long ago (see Robotics in Your Future) that I wrote about the role of robotics in accessibility, especially with regard to the exoskeleton. At that time, universities and several vendors were experimenting with exoskeletons and showing how they could help people walk. The software solutions I provide in Accessibility for Everybody are still part of the answer, but more and more it appears that technology will provide more direct answers, which is the point of this post. Imagine my surprised when I opened the September 2011 National Geographic and found an article about eLEGS in it. You can get the flavor of the article in video form on the National Geographic site. Let’s just say that I’m incredibly excited about this turn of events. Imagine, people who had no hope of walking ever again are now doing it!

We’ve moved from experimental to actually distributing this technology—the clinical trials for this device have already begun. The exoskeleton does have limits for now. You need to be under 6 foot 4 inches tall and weigh less than 220 pounds. The candidate must also have good upper body strength. Even so, it’s a great start. As the technology evolves, you can expect to see people doing a lot more walking. Of course, no one who has special needs is running a marathon in this gear yet. However, I can’t even begin to imagine the emotion these people feel when they get up and walk for the first time. The application of this technology is wide ranging. Over 6 million people currently have some form of paralysis that this technology can help.

eLEGS is gesture-based. The way a person moves their arms and upper body determines how the device reacts. Training is required. The person still needs to know how to balance their body and must expend the effort to communicate effectively with the device. I imagine the requirements for using this device will decrease as time goes on. The gestures will become less complex and the strength requirements less arduous.

So, what’s next? Another technology I’ve been watching for a while now is the electronic eye. As far as I know, this device hasn’t entered clinical trials as of yet, but the scientists are working on it. (It has been tested in Germany and could be entering trials in the UK.) The concept is simple. A camera in a special set of glasses transmits visual information to a chip implanted in the person’s eyeball. The chip transmits the required signals to the person’s brain through the optical nerve.  However, the implementation must be terribly hard because our understanding of precisely how all of this works is still flawed.

Even so, look for people who couldn’t walk to walk again soon and those who couldn’t see to see again sometime in the future. There will eventually be technologies to help people hear completely as well. (I haven’t heard of any technology that restores the senses of smell, taste, or touch to those who lack it.) This is an exciting time to live. An aging population will have an increasing number of special needs. Rather than make the end of life a drudge, these devices promise to keep people active. Where do you think science will go next? Let me know at [email protected].

Understanding Line-, Token-, and String-Based Command Line Utilities

My books, Windows Command-Line Administration Instant Reference and Administering Windows Server 2008 Server Core, both contain batch file sections that answer basic needs, but sometimes you need more than basic information to perform a task. A reader asked me how to perform a task using the FindStr utility the other day based on my Regular Expressions with FindStr post. The problem is that FindStr is a line-based utility, and the reader was trying to obtain a token-based result. Using FindStr alone won’t solve the problem. Here is the original reader comment:

 

If I have lines like below in a file called Sum.txt :

Total001 abcdefg
Total002 hijklmn
Total099 opqrstuv

and I use a regular expression to get all the results like “findstr Total[000-099] Sum.txt” the result printed is :

Total001 abcdefg
Total002 hijklmn
Total099 opqrstuv

But I want it to print only the matches to the regular expression like

Total001
Total002
Total099

How can this be done?


And my response:

 

The FindStr
utility is line oriented, which means you obtain an entire line as
output, not individual tokens. In order to accomplish what you want to
do, you need to create a For loop. Using a For
loop would allow you to process the individual tokens in the line. The
following command will do what I think you want to accomplish:




For /F “UseBackQ” %1 In (`FindStr Total[000-099] Sum.txt`) Do @Echo %1




There are two important things to notice here. First, you must provide the “UseBackQ”
option or the command won’t work. The command itself must appear in
back-quotes—not regular quotes. The back-quote normally appears above
the Tab button and to the left of the 1 on a keyboard. It usually
appears with the tilde (~) character.



Using For makes it possible to create a token-based output from the line-based FindStr output. The default For setting relies on the space and tab characters as delimiters, but you can use the Delimiters= option to change the default behavior. However, sometimes a token-based result isn’t enough. You may not want an entire word (or whatever element the delimiters define). In this case, you need a string-based output.

One of the undocumented features of the command line is to create substrings from variables. For example, let’s say you define the following variable:

 

Set MyVariable=Hello World


Now, you want to obtain just a piece of that variable to use somewhere in your batch file. To obtain the substring, you use the tilde (~) operator. This operator uses a 0-based offset. So, let’s say you issue the following command:

 

Echo %MyVariable:~3%


The output of this command is: lo World. The output begins with the forth character, which is an l and displays the remainder of the string. However, let’s say you don’t need the rest of the string. Well, in this case, you can add a second number to define the characters you do need. If you issue this command:

 

Echo %MyVariable:~3,6%


the output is: lo Wor. The output begins with the fourth character and proceeds to the ninth character. The output contains the six characters you requested. In short, it’s possible to perform some fancy string manipulation in batch files as long as you keep the short of output you need in mind. Let me know how you use batch files to perform various sorts of string manipulation at [email protected].

Remembering to Rest

It’s easy to become so involved in self-sufficiency issues that you forget to rest. Rebecca and I just finished Harvest Festival (see my Fun is Where You Find It! (Part 3) post for details), so we’ve made our big push in getting the larder filled. Of course, there is still plenty of work to do. We even have some extra pears to process this year thanks to the prolific output of our Luscious pears. With everything there is to do, self-sufficiency can quickly become more work than anticipated and definitely become work of the worst sort. Rest is necessary. You have to take time to smell the flowers and get a bit of fresh air. That’s precisely what we did this weekend when we went to Wildcat Mountain, a local state park.

Everything at the park is quite beautiful. One of my favorites there are the wildflowers. A number of them bloom in the fall:

WildcatMountain1

The tree colors haven’t peaked yet, but there are some incredibly beautiful trees. I particularly liked this pair.

WildcatMountain2

We took a picnic lunch and enjoyed a few games of Acey-Ducey (a kind of backgammon). After lunch, we went to observation point, which has an amazing vista of the farms and forest in the surrounding area. Here’s just one of many views we saw.

WildcatMountain3

You can easily suffer vertigo looking down from this height. Here’s a picture of the two of us that gives you a little better idea  of just how high we are.

WildcatMountain4

We also decided to take a bit of a hike. Wildcat Mountain has a lot of trails, some of which are more than a little difficult to traverse. Just about all of the trails require that you climb lots of stairs. Even so, the scenery is gorgeous. We decided to take the Old Settler’s Trail.

WildcatMountain5

The point is that we spent some time doing something other than preparing food for winter, even if we didn’t get to rest the entire day. Part of your self-sufficiency planning has to go into rest. Without proper rest, you’ll make mistakes and your self-sufficiency plans will quickly become grueling work. Keep things fun! Let me know how you rest after a hard work session at [email protected].

 

Considering the Unexpected Harvest

A number of my posts deal with the unexpected or a way of viewing the garden in a way that puts things in perspective. For example, a recent post, Every Year is a Good and a Bad Year, discusses how each year can produce unexpected results in the garden. Planting a wide range of vegetables is your only way to deal with the potential yield differences from year-to-year. Of course, diversity is good for your health and the soil as well. This post looks at the same issue from the perspective of the orchard.

The orchard is different from the garden in that you plant an orchard for a long term yield. Our first pear trees were planted 11 years ago. When you make such a long term investment, you need to place an even stronger emphasis on biodiversity. For example, this year started extremely wet. A frost occurred while the trees were in bloom—killing many of the blossoms. To make things worse, we had golf ball-sized hail after the fruit had set. The hail actually knocked some of the fruit off of the trees. After spring, however, things got incredibly dry, making it even less likely that the fruit trees would do well. So, I had expected a very small harvest this year (and I wasn’t disappointed). The largest pear harvest we’ve had was 975 pounds. This year the trees produced 300 pounds of standard sized fruit, or so I thought.

Our Luscious pears are generally quite small. However, they’re so incredibly sweet and juicy that they’ve become a favorite of ours. Normally, we leave these pears on the trees for later use. In order to can a pear, you must pick it just a tiny bit green, when the pear is still hard enough to survive the canning process. Pears used for juice, as our Luscious pears are, generally need to wait until they’re almost overripeat the absolute peak of sugar and taste. Consequently, I didn’t pay as much attention to the Luscious pears as I should have. The interesting outcome is that we now have standard sized pears on a tree that isn’t supposed to have them. The pears are between two and four times larger than normal.

PearSizeDifference

The upper pear is representative of what the Luscious pear as produced this year. The lower pear is what we get on most years. Not only is the top pear larger, it weighs three times as much as the lower pear. The difference is enough that we’ll be able to can the Luscious pears that are still green enough. In addition, the Luscious pear trees normally produce around 80 pounds of fruit. This year they produced 120 pounds of fruit, so we have a lot more fruit than I had originally thoughta total of 420 pounds.

In addition to the Luscious pear anomaly, the Parker pears produced well this year. Normally, we have fire blight problems with the Parker pears, but there was almost no fire blight at all this year because it was so dry. Trees that normally produce well, such as the Moonglow and Clapps, didn’t do well this year because of the dryness. The point is that you need a variety of trees if you want a good harvest every year. The trees also have to be compatible. If you check the links I’ve provided in this article, you’ll see that all of these trees require a pollinator tree other than itself. The Luscious pear is a male tree, while the other pears in the orchard are all female. All of them produce fruit, but to get an optimal yield, you need to have pollinators of the right type.

The lesson I keep relearning is that it’s essential to check everything before making a judgement. If I had picked the Luscious pears earlier this year, we would have had more fruit for use in pear chunks (minted, plain, or spiced). As things stand now, we’ll probably end up with juice for wine and drinking, some pear jam, and some additional pear sauce because the fruit is too ripe to use for pear chunks (something that our larder was lacking). Let me know if you have any questions at [email protected].