Running .exe file with .ini file

Hi,

Please advise on how to fix below;

Trying to run;
SET AppExec1=start /wait "%~dp01_Completed\EXE\Source\setup.exe" -r "%~dp01_Completed\EXE\Source\Install.ini"

getting error


Thank you in advance
Moin AhmedAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewCommented:
Are you sure it is failing on the SET statement you showed, I ran that exact statement here and did not get an error, and it did create the AppExec1 environment variable.

However if I do try and execute the %AppExec1% variable I get the error you are showing, so I assume that is actually what you are doing?

If that is the case, then try this for your SET:

SET AppExec1=start /wait "" "%~dp01_Completed\EXE\Source\setup.exe" -r "%~dp01_Completed\EXE\Source\Install.ini"

Open in new window


»bp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Moin AhmedAuthor Commented:
Great! it works :)

can you explain why adding "" worked? (I am rookie to scripting)
0
Moin AhmedAuthor Commented:
can you explain why adding "" worked? (I am rookie to scripting)
0
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Bill PrewCommented:
Sure, if you look at the help for the START command by doing the following at a DOS command prompt:

START /?

or by viewing the online info:  Start | Microsoft Docs

Notice that an optional <title> can be specified as the window title of the started executable. A small glitch in the START command though is that if you put double quotes around the path to the executable (like you have done since it could have spaces in it) then the title becomes required.  So adding in an empty title satisfies this, and avoids the error you were getting.

Let me know if that makes sense.


»bp
0
Bill PrewCommented:
And welcome to the site!


»bp
0
Moin AhmedAuthor Commented:
Thank you so much!
0
Moin AhmedAuthor Commented:
Also, If you can advise on more thing. AppExec1 works fine but AppExec2 never initiates


SET AppExec1=start /wait "" "%~dp01_Completed\EXE\Source\setup.exe" -r "%~dp01_Completed\EXE\Source\Install.ini"
SET AppExec2=start /wait "" "%~dp01_Completed\EXE\Patches\setupSP12.exe" -r "%~dp01_Completed\EXE\Patches\InstallSP12.ini"

%AppExec1%
%AppExec2%
0
Bill PrewCommented:
Well, for one thing you are running the first with the /WAIT, which may be exactly what you want, for the first to finish before the second runs.  But naturally until the first actually finishes the second won't run.

In addition, not all EXE's are "well behaved".  If the first program is running, and then ending, and the second never runs, I suspect it's because the first terminated the whole environment it was launched from when it ended, including the BAT script.  So it never gets control back to proceed to the next line of the BAT file, running the second EXE.


»bp
0
Moin AhmedAuthor Commented:
my goal is to run AppExec1, let it finish and then run AppExec2.

Should I consider putting a loop here?
0
Bill PrewCommented:
You might be able to do a loop, checking for when the first process is not found anymore.  If you want more help once you get started post a new question to get some experts looking.


»bp
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.