Subscribe to Windows IT Pro
July 28, 2008 12:00 AM

Use Cmd.exe's Start Command to Simplify Setup Automation

Achieve small-scale software deployment without errors or omissions
Windows IT Pro
InstantDoc ID #99528
Rating: (3)

You could use the /d option if the directory path had spaces in it, but here our problem is the executable itself. Start offers no way to specify that the quoted string is really the path.

There are two solutions to this problem. One is to provide a quoted string first. For GUI installers, the title won’t matter, but you must provide a quoted title string initially so that Windows will interpret the quoted command path correctly. We can modify the nonfunctional batch file line by adding a quoted string to make it work:

start "" /w "z:\dsp\misc\Acme
  Shipping.exe"

Another alternative is to rename the setup file. This is useful anyway for rarely visited networks, because you can add versioning information to the title while you’re at it, as well as a string to identify the executable as a setup file. If you pick a name such as AcmeShippingSetupv5.1.exe, you get an additional bonus: Windows Server 2008 and Windows Vista will automatically prompt for privilege elevation when invoking an application that has the word “setup,” “install,” or “update” in its name, ensuring that the application installs properly. As a result, if you later do click-and-run installations you’ll get helpful prompting.

Add Command-Line Options
When you use Start to run an application, Start passes everything that follows the application name to the application as arguments, so adding command-line options is straightforward. Suppose you’re installing Windows Defender from the file WindowsDefender. msi. Windows Installer packages universally support certain command-line options. For example, /log followed by a colon and the name of a log file records installation details to the named log. So, if you wanted to log details to c:\install.log and weren’t using the Start command, you could do so by executing the command

z:\dsp\core\WindowsDefender.msi
  /log:c:\install.log

You use precisely the same command if you’re executing it with the Start command. If you want to start the installation and wait, you just use this:

start /w z:\dsp\core\Windows
  Defender.msi /log:c:\install.log

The only special case is if an argument needs quotes. You can use the same technique I demonstrated in the section about handling paths with spaces and include an initial empty quoted string. Therefore, if you were logging installation data to C: Install Records.log, you would use a Start command such as

start "" /w z:\dsp\core  WindowsDefender.msi /log:"C:\Install
  Records.log"

Simple Automation in Minutes
What makes Start commands especially nice is that when you’re ready to perform a sequence of installations, you simply put all the Start commands into a text file—each command on its own line in the order you want to run it, then save the file with a .bat or .cmd extension. You can save the batch file to a network folder located above all the installation media you use, to make it easy to locate each time you need to add or remove a standard installation item.

Given a large infrastructure and budget, a tool such as SMS is still a winner, not least because it does other things in addition to automating software setup. But when you don’t have that tool, using a batch file with the Start command returns a lot of value for the investment of only a little time.

Related Content:

ARTICLE TOOLS

Comments
  • Caroline
    4 years ago
    Aug 04, 2008

    @glenmcl--it's loaded now. You can click the sidebar link beneath the title above or go to this URL:
    http://windowsitpro.com/articles/articleid/99675/Use_Batch_Files_to_Automate_Application_Installation.html

  • Caroline
    4 years ago
    Aug 01, 2008

    It is being loaded August 1 or August 4. I hope you'll look again and let us know your thoughts about the articles!
    Caroline Marwitz

  • Glen
    4 years ago
    Jul 30, 2008

    The printed article contains an author's note that there is a simpler method that he has since crafted which is discussed in InstantDoc ID 99675. That doc does not seem to exist?

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.