Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


August 2008

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

Achieve small-scale software deployment without errors or omissions
RSS
Subscribe to Windows IT Pro | See More Windows OSs Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!
SideBar    Use Batch Files to Automate Application Installation

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.

End of Article

   Previous  1  [2]  Next  


Reader Comments
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?

glenmcl July 30, 2008 (Article Rating: )


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

Caroline from editorial August 01, 2008 (Article Rating: )


@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 from editorial August 04, 2008 (Article Rating: )


You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now




Top Viewed ArticlesView all articles
Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

WinInfo Short Takes: Week of November 23, 2009

An often irreverent look at some of the week's other news, including some post-PDC some soul searching, a Google Chrome OS announcement and a Microsoft response, Windows 7 off to a supposedly strong start, the Jonas Brothers and Xbox 360, and so much more ...

2009 Windows IT Pro Editors' Best and Community Choice Awards

Picking a favorite product from an impressive crowd of competitive offerings is never an easy task, and such was the case with our Editors' Best and Community Choice awards this year. ...


Related Events Deep Dive into Windows Server 2008 R2 presented by John Savill

Check out our list of Free Email Newsletters!

Windows OSs eBooks Understanding and Leveraging Code Signing Technologies

A Guide to Windows Certification and Public Keys

SQL Server Administration for Oracle DBAs

Related Windows OSs Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement