Invalid switch unless line is run separately

ThexTallxDude picture ThexTallxDude · Jun 24, 2016 · Viewed 15.5k times · Source

My .BAT has one Install Shield line that errors out with invalid switch /s, unless it is run in a separate command prompt. I'm new to all this, and all I can think is that it's because it is a different syntax. Is there a way to get this to run in the same batch as the rest of the install?

This is the line in Question:

    START /wait %desktop%\Serverx64\CDImage_1100_1003a\setup.exe /s /a /s /sms /f1c:\Temp\setup.iss

And this is my .BAT:

@echo off
@echo Installing SQL

MD C:\tempdasql

COPY ConfigurationFile.ini C:\tempdasql > nul
SQLEXPRWT_x64_ENU /ConfigurationFile="C:\tempdasql\ConfigurationFile.ini"
@echo SQL Installed
@echo:

@echo Installing 2005 BC
MSIEXEC /i SQLServer2005_BC_x64.msi /qb
@echo Installed 2005 BC
@echo:

DEL C:\tempdasql\ConfigurationFile.ini
RD C:\tempdasql

TIMEOUT /T 3
@echo:
@echo Installing WinRAR

SET desktop="%userprofile%\Desktop"

START "WinRAR" /wait %desktop%\Serverx64\winrar\wrar393.exe /s

SET winrar="C:\program Files\WinRAR\WinRAR.exe"

MD %userprofile%\Desktop\Serverx64\CDImage_1100_1003a\
@echo Extracting Foo
@echo:

%winrar% x %desktop%\Serverx64\CDImage_1100_1003a.iso %desktop%\Serverx64\CDImage_1100_1003a\

TIMEOUT /T 3
@echo:
@echo Installing Foo

MD C:\Temp

COPY %desktop%\Serverx64\Setup.iss C:\Temp\ >nul


START /wait %desktop%\Serverx64\CDImage_1100_1003a\setup.exe /s /a /s /sms /f1c:\Temp\setup.iss

DEL C:\Temp\setup.iss
RD C:\Temp

Copy C:\Foo\msvcr71.dll C:\Foo\Support\ >nul
START C:\Foo\Support\Pmtools.exe

Answer

ThexTallxDude picture ThexTallxDude · Jun 24, 2016

Fix was provided by Aschipfl. Placing a "" after START to create an empty string resolved the issue. Without the string following the START command, the batch was incorrectly processing my filepath and switches.