Creating Links Between File Extensions and Batch Files

A couple of weeks ago I wrote a post entitled, “Adding Batch Files to the Windows Explorer New Context Menu” that describes how to create an entry on the New context menu for batch files. It’s a helpful way to create new batch files when you work with them regularly, as I do. Readers of both Administering Windows Server 2008 Server Core and Windows Command-Line Administration Instant Reference need this sort of information to work with batch files effectively. It wasn’t long afterward that a reader asked me about creating links between file extensions and batch files. For example, it might be necessary to use a batch file to launch certain applications that require more information than double clicking can provide.

This example is going to be extremely simple, but the principle that it demonstrates will work for every sort of file extension that you can think about. Fortunately, you don’t even need to use the Registry Editor (RegEdit) to make this change as you did when modifying the New menu. The example uses this simple batch file named ViewIt.BAT.

@Echo Processing %1
@Type %1 | More
@Pause

Notice that the batch file contains a %1 entry that accepts the filename and path the Windows sends to it. You only receive this single piece of information from Windows, but that should be enough for many situations. All you need to do then is create a reasonably smart batch file to perform whatever processing is necessary before interacting with the file. This batch file will interact with text (.TXT extension) files. However, the same steps work with any other file extension. In addition, this isn’t a one-time assignment—you can assign as many batch files as desired to a single file extension. Use these steps to make the assignment (I’m assuming you have already created the batch file).

  1. Right-click any text file in Windows Explorer and choose Open With from the context menu.
  2. Click Choose Default Program from the list of options. You see the Open With dialog box shown here.
    Link01
  3. Clear the Always Use the Select Program to Open this Kind of File option.
  4. Click Browse. You see the Open With dialog box.
  5. Locate and highlight the batch file you want to use to interact with the text file (or any other file for that matter) and click Open. You see the batch file added to the Open With dialog box.
  6. Click OK. You see the batch file executed on the selected file as shown here.
    Link02

At this point, you can right-click any file that has the appropriate extension and choose the batch file from the Open With menu. The batch file will receive the full path to the file as shown in this example. It can use the information as needed to configure the environment and perform other tasks, including user interaction. Let me know your thoughts on linking file extensions to batch files at [email protected].

 

An Update On Our Pullets

I recently wrote about our chickens first attempts at laying eggs in my Pullet Eggs post. Of course, nothing remains static. Our nine pullets are laying four eggs on average every day now. That number will increase as spring approaches because the number of daylight hours is increasing. Depending on which source you use, chickens require somewhere between 12 and 14 hours of daylight in order to lay eggs with any frequency.

There are some interesting things to consider beside the number of hours of daylight, however. For example, some chickens are winter layers—they are significantly less affected by the number of daylight hours than other breeds. Our Delaware pullets seem to lay eggs nearly every day. The Ameraucanas are less affected by the lack of daylight, but they lay only every other day. The Black Australorp is laying few eggs (about one a week) because she’s not a winter layer. The Buff Orpingtons naturally lay fewer eggs than the Delawares or Ameraucanas, so it’s hard to tell much about their laying capacity in the winter. We’ll learn more as time progresses.

The weather seems to have less to do with egg laying than the number of daylight hours does. Our chickens seem to continue producing eggs at a regular pace no matter what the outside temperature might be. This past week has seen some extreme cold, but the chickens continued laying. The coop is unheated, so we checked for eggs regularly to keep them from freezing. We also kept the chickens in the coop on days where the daytime temperature was below 20 degrees Fahrenheit.

Hen health is important for getting good eggs though, so we make sure our hens have enough of the right sorts of things to eat. Because this is winter and there are no bugs for our hens to eat, we make sure that they get plenty of high protein food sources. The hens also get greens and other kitchen scraps. Sometimes they look quite funny running around with bits of fruit in their beaks. Along with all of their other food, we do provide them with layer mash—a necessity to ensure they get enough calories to survive the cold temperatures.

We also had something interesting happen with our Black Australorp this past week. She laid the largest double yolked egg I’ve ever seen—it wouldn’t even fit in the egg carton. After I saw the egg my wife brought in, I decided to check our hen to make sure she hadn’t been damaged by laying it, but she seemed just fine. Double yolked eggs are somewhat rare, about 1 in 1000. One this size must be rarer still. I wish I had gotten a picture of it, but we ate it before we thought to get a picture. Unfortunately, it will be a long time before we get another.

Our pullets will turn into hens soon. Each day the eggs get a little larger and we’ll soon have jumbo-sized eggs. The eggs are about medium in size now. We plan to get an egg scale so that we can size the eggs correctly. In the meantime, seeing our chickens grow and develop is nothing short of amazing. Let me know about your chicken experiences at [email protected].

 

Unexpected Drought Consequences

I’ve written a number of posts about the effects of global warming from a personal perspective. It does make a difference in how I view the whole issue of global warming. Whether global warming is a matter of cyclic world changes, human interaction, natural sources, or some combination of thereof isn’t the point-the point is that the earth is getting warmer, which is causing changes of various sorts that affect me as a person. Your best way to deal with these changes is to make a list of how they affect you and come up with effective strategies for dealing with them.

This summer saw a drought come to our area. There is more than a little evidence to say that the drought is just another effect of global warming. People focus on droughts during the summer months because crops are affected, grass dies, and the heat becomes oppressive. The television, radio, and newspaper blare pronouncements of impending doom from dawn till dusk each day. However, the winter effects of drought can become even more devastating than those in summer.

Consider the fact that snow acts as an insulating blanket for the earth. It helps retain some of the heat in the deep layers. When there is a lack of snow, frost tends to go further into the ground and cause all sorts of nasty consequences, especially during a heavy freeze. My reason for writing about heavy freezes is that we’re experiencing one here in Wisconsin and I’m concerned about the potential of damage to either my well or septic system. Nothing is quite as exciting as living almost four miles from town and not being able to use any water because your septic system is frozen. Once frozen, you need to call a professional to thaw the system so you can use it again. If your professional is especially busy, you may be waiting for a few days.

The problems of deep frost aren’t limited to the well or septic system. A deeper frost creates more heaving-water freezes and the resulting ice displaces some of the earth underground. The most conspicuous result of heaving is that any pavement on your property buckles and doesn’t last nearly as long as it could. It’s possible to assign an actual dollar amount to the lost longevity of your sidewalks and driveway. The effects can also profoundly affect your house’s foundation.

Heaving also causes myriad other problems for the self-sufficient person. For example, those posts you put in for your grape vines will become misaligned-forcing you to spend time readjusting the cables and possibly damaging the vines. A deep frost can kill tree, vine, and permanent bed plant roots. You’ll also have the pleasure of picking more rocks from the garden come spring because heaving brings them to the surface (despite the perception that they grow there during the winter). I’m also wondering how a deep frost will affect our new chicken coop (despite having put the posts as deeply as we could in the ground, heaving will still have an effect on them).

There is also the direct heating costs to consider. A blanket of snow on your roof acts as additional insulation. When this blanket is removed completely, your house loses more heat. If you do find that you are losing a lot of heat from your roof, you might want to consider looking at some cedar park roofing companies to come and assess for any damage. Of course, there is also a problem when there is too much snow on your roof (causing damage from the weight) and the whole issue of ice dams. Winter is the worst time to be struck with a roofing emergency so if you suspect any signs of damage, you may wish to contact someone at trusted-roofing.com promptly. Although it can be nice to have that extra heat in your home, there are dangers of having a thick layer of snow on your roof. To prevent any future damage, you might want to ask a company (like this roofing austin service) to check that your roof hasn’t become vulnerable after having that layer of snow on it throughout winter.

Drought causes serious problems during the winter as well as the summer. No matter where you live, you have to consider the effects of drought on your property and the structures it supports. What sorts of winter drought effects have you seen in the past? I’ve seen cases of areas with sustained droughts end with torrential rainfall, the issue in this particular case of a friend of mine… I was told their property was drenched by rainfall after searing heat for weeks, the problems they came to face was a pooling of water in places near their home where they’ve never experienced it before, and caused water damage to their basement and foundations. The issue being, their homes’ gutters hadn’t been used in weeks and therefore became clogged with all sorts, because of the heat they had completely forgotten about the gutters. Either way, once they got in touch with a company like this Clean Pro Gutter Cleaning Denver area (Of course it was Colorado!) they had their gutters cleaned out, the pooling of water drained and their properties structure checked over for repairable damage – so in this case, their extreme drought caused them some serious water damage in the coming weeks. This leads me to the question, do you think the increased number of droughts is due to a natural cycle in the earth’s weather pattern or from global warming (or possibly a combination of both)? Write me about your drought observations at [email protected].

Sending Comments and Asking Questions

Anyone who reads my blog for very long understands that supporting my books is a big deal for me. I actively work with my readers because I realize that you have the choice of using books written by other authors. Let’s just say that my support system is one of the reasons you really do want to buy my books. My blog not only answers common questions you have, but also adds examples and other information to the information you already receive through my books, so make sure you keep you eyes peeled for additional information here as well.

The last time I discussed this topic was in 2011 in my Contact Me, Please! post. The same things apply now as they did then. I’ll answer your book-specific questions as soon as I possibly can and in as much detail as I can. However, I won’t write your school term paper for you, accept a marriage proposal, or provide free consulting (amongst other things readers have asked me to do in the past). If you’re having problems with an example or can’t find the book’s source code, please be sure to ask because I want your experience with my books to be nothing less than phenomenal.

I also encourage you to be a beta reader. You can see the posts I’ve made for several recent books. The biggest reason for me to ask readers to participate in the book building process is to ensure you get the book you want. I also want to avoid Errors in Writing. As far as I know, I’m the only technical author on the planet that invites reader comment during the writing process, but I truly feel your input is essential, so I request it in every way I can. As I get new book contracts, you’ll continue to see requests for beta readers posted on my blog.

You can always contact me at [email protected] with any comments and questions you have. This includes both books and blog posts. Let me know about any concerns you might have and I’ll do my best to solve them. In the meantime, happy reading !

 

Pruning the Grapes (Part 1)

Previously I had written about trimming our trees. We normally perform tree trimming in March or possibly April in a really cold year. The snow is gone and the temperatures, even though they’re still quite cool, are warm enough to work in without suffering frost bite. Pruning grapes seems to be a different story. Past experience has shown us that pruning grapes in March almost assures that we won’t obtain much in the way of a harvest because the cuts don’t have time to heal properly before the grapes start pumping water into the stems. What you end up seeing is water dripping from all of the cuts if you prune grapes that late.

We’ve also tried pruning our grapes in the fall. Unfortunately, the winter air damages the cut ends, leaving more dead material than we would like. It also seems as if the wildlife takes the fresh cuts as an invitation for further pruning. We actually had several vines trimmed to unusable nubs by the local deer. Obviously, fall pruning doesn’t work for us either.

As with many other self-sufficiency issues, this one is a learning experience. We know that if we keep at it long enough, eventually we’ll have a good system down for our grapes. You can read all you want and ask everyone who has any idea at all about how to do things, but your plot of ground is different from any other plot of ground out there. When you’re self-sufficient, you have to be prepared to experiment. So, undaunted by previous failures, this year we’re pruning our grapes in mid-January. The timing will allow the grape ends to heal before spring takes hold, but should present less opportunity to the local wildlife for extra trimming and the weather won’t have as much of an effect either.

The approach you use for pruning your grapes depends on your weather and the method you use to train them. We use a four-cane Kniffin system. The approach yields a relatively large number of grapes, is easy to maintain, and doesn’t tend to have problems with mildew due to lack of airflow (as is the case with arbors). Picking can be more time consuming than when working with arbors and you need a source of rot resistant posts. Fortunately, we do have a native source of rot resistant posts in the form of the black locust trees that grow in our woods. Farmers actually planted them to use as fence posts.

Most of the books we have say that it takes seven years for grapes to grow to sufficient size to start producing well. Our own experience says that it’s more like ten years, especially if you have wildlife constantly nibbling at the canes. We finally ended up staking out one of our dogs to keep the wildlife at bay one year so the vines could grow unmolested.

We’ve chosen to plant a number of grape varieties: Niagra (white), Catawba (red), Concord (purple), Delaware (pinky purple), and King of the North (blue). Each cultivar has specific properties to recommend it. For example, the Delaware produces an outstanding wine grape, while the Concord is better for jelly production. The King of the North is a good juice or table grape. We prefer the Niagra for table and juice uses, but it should also make for a nice wine. The Catawba has yet to produce sufficient quantities of grapes for us to test it for various uses, but we’re assuming that we’ll use it for wine. When choosing grapes for your own vineyard, make sure you pick from a variety of cultivars. A single mature trunk can produce a significant number of grapes (upwards of 40 pounds), so you need a plan for using them.

It’s also a mistake to prune every year. I had noticed some of our local vineyards don’t trim their canes absolutely every year. When I started pruning every other year, our harvest went up significantly without reducing the vitality of the vines. It may be that some locations require yearly pruning, but this doesn’t seem to be the case here.

What are your experiences with grapes? Do you favor particular cultivars over others? Let me know your thoughts at [email protected].

 

Adding Batch Files to the Windows Explorer New Context Menu

Administrators are always looking for ways to perform tasks faster. Most administrators have little time to spare, so I don’t blame them for looking for new techniques. One of the ways in which administrators gain a little extra time is to automate tasks using batch files. Both Administering Windows Server 2008 Server Core and Windows Command-Line Administration Instant Reference provide significant information about creating and using batch files to make tasks simpler. However, a number of readers have asked how to make creating the batch files faster by adding batch files to the Windows Explorer New context menu. That’s the menu that appears when you right click in Windows Explorer. It contains items such as .TXT files by default, but not .BAT (batch) files.

Being able to right click anywhere you’re working and creating a batch file would be helpful. Actually, the technique in this post will work for any sort of file you want to add to that menu, not just batch files, but the steps are specific to batch files.

 

  1. Open the Registry editor by typing RegEdit in the Search Programs and Files field of the Start Menu and clicking on the RegEdit entry at the top of the list.
  2. Right click the HKEY_CLASSES_ROOT\.bat key and choose New | Key from the context menu. You’ll see a new key added to the left pane.
  3. Type ShellNew and press Enter.
  4. Right click the new ShellNew key and choose New | String Value from the context menu. You’ll see a new string value added to the right pane.
  5. Type NullFile and press Enter. Your Registry Editor display should look like the one shown here.
    NewBatchFile01

At this point, you should be able to access the new entry in Windows Explorer. Right click anywhere in Windows Explorer and choose the New context menu. You should see the Windows Batch File entry shown here:

NewBatchFile02

Selecting this entry will create a blank batch file for you in the location you selected. All you need to do is open the file and begin editing it. What other sorts of time saving methods do you find helpful in working with batch files? Let me know at [email protected].

 

Too Much Detail

A trend has started in publishing of all sorts and it affects technical writing most of all. A friend of mine recently wrote a piece entitled, “A Multimedia Avalanche.” The post spoke to me on many different levels. As an author, it spoke to me of the need to keep my pieces short and to the point. No one wants to read every detail about every event that has ever happened—it simply isn’t possible to absorb more than the “Reader’s Digest” version of many of the events that take place in our lives. It makes me think of the supposed Sergeant Friday (Dragnet) quote, “Just the facts, ma’am.” The problem with using a medium such as the Internet is that people tend to think in terms of unlimited space, rather than limited reader attention. As an author, it’s important to write concisely, yet clearly.

As a reader, it spoke to my desire to throttle some authors to within an inch of their lives. After wasting my time, they never do seem to get to the point. An editor of mine is famous for pointing to the need to state the purpose of an article within the first paragraph and then to keep the article focused on that purpose. It’s good writing practice to write the beginning and ending of the article first, and then write the material needed to fill in the details. It’s a simple trick to keep the article short and focused.

As a citizen, the article spoke to the need to keep the media in check. No, the government shouldn’t perform this task; the reader should. When the media hypes a story all out of proportion, it brings out the mob mentality of some people. Suddenly, the government finds itself swamped with calls for needless changes for a non-event that was sensationalized by someone who wasn’t thinking. These sorts of issues tend to waste considerable funds that could be better used for other purposes (such as saving the taxpayer from an increase in taxes).

Information overload, wasted money, wasted time, and other such problems will only increase as citizen journalists and others with way too much time on their hands contribute toward an increasing array of articles that bury the reader in detail. To quote my friend’s article, “just because you can do something doesn’t always mean you should.” It’s good advice.

What is your take on too much detail, especially as it relates to technical writing? Let me know your thoughts at [email protected].

 

Winter Feathers


Feathers

Feathers on my window pane,
Tell me winter’s here again.
Elfin hands paint lines at night,
That morning’s sun, shows so bright.

Though the feathers look like glass,
With winter’s sun they cannot last.
Like a dream they fade away,
‘Til nothing’s left in the day.

Come the night they reappear,
As the sun does disappear.
Each cycle brings to my view,
Winter feathers always new.

Copyright 2013, John Paul Mueller