Hey guys,

Could someone show me how to write a batch file to install software? I just need something very basic that, when run, will auto install the software.

I know it isn't that hard, but I don't know how. :(
thanks!

Dani AI

Generated

Short practical guide to make a .bat actually install software (grounded in the thread above). The usual failure causes are working-directory or path problems, missing quotes around paths with spaces, the installer spawning a separate process so the batch exits immediately, wrong “silent” switches for that installer, or lack of elevation. is right that a batch is just one command per line; and are also correct that switches differ by product. The OP’s note about an existing .ini is useful — most vendor wrappers accept a config-file switch, but the exact flag is installer-specific.

MSI example (reliable, standard switches; writes a log and checks result):

@echo off
set "LOG=%~dp0install.log"
msiexec /i "%~dp0MyProduct.msi" /qn /norestart /l*v "%LOG%"
if %ERRORLEVEL% NEQ 0 (
  echo Install failed: %ERRORLEVEL% >> "%LOG%"
) else (
  echo Install succeeded >> "%LOG%"
)

EXE wrapper example (shows waiting and passing a config file — the shown switches are illustrative; consult the installer’s docs for the exact syntax):

@echo off
set "EXE=%~dp0Setup.exe"
set "INI=%~dp0installer.ini"
start "" /wait "%EXE%" /S /INI="%INI%"
echo Setup returned %ERRORLEVEL% >> "%~dp0install.log"

Troubleshooting checklist: run the batch from a command prompt (not by double‑click) to see immediate errors; always quote paths and use %~dp0 to reference the batch folder; use start /wait when the launcher hands off to another process; check the installer’s documentation or run the installer with /? or /help to discover silent switches; ensure the script runs elevated on Vista/Windows 7+; inspect the verbose log (use MSI /l*v or vendor log switches). For multi-machine deployments, consider packaging tools or MSI repackaging so switches are consistent.

Recommended Answers

All 16 Replies

Why not post this in the programmers forum? I know you know this as you've been around the site for awhile.

well, considering it's more pertaining to DOS....

installing windows software with a .bat? you would need to find the actual setup switches to make it a silent install, and those are product specific

Member Avatar for Member #127113

Why not you use Autorun.inf (Setup Information) it will Auto Execute the Setup.exe.

but that way unattended or scripted setup will not work

Member Avatar for Member #127113

For more Configuration also can setup a .ini file for it.

I have a .ini file setup that does a complete installation with no user intervention. I need a way to run the link through a script though.

This random link might help

http://www.leeos.com/infdoc.html

I don't completely understand it myself, just in theory.

Hope it helps

Member Avatar for Member #127113

Also you can link .bat (MS-DOS Batch Script) through Autorun.inf File.

I understand how to make the script autorun, but I need help writing it.
Thanks though

yep, that really depends on the program. Just a double click silent install?

Member Avatar for Member #46692

Seriously, if you are using a big microsoft products i.e, office, outlook, autocad etc, just fire them off from the msi installers and call the relevant switches.

It really is that simple.

? you would need to find the actual setup switches to make it a silent install, and those are product specific

Not really. Most MSI packages use a standard set of switches (i wrote a bat file to install all MS hotfixes post SP2)

I understand how to make the script autorun, but I need help writing it.

Thanks though

you just write the DOS commands, one to a line (as if you were hitting enter. Thats it)

I don't know which DOS commands to use though :( i r newb, i know.

c:/pathtoinstaller/setup.exe
c:/pathtoinstaller2/setup.exe

etc...

something like that

I've done that, and saved it as a .bat file. Didn't work though.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.