cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
DonAIR
Level 6

LaunchApplication/LaunchAppAndWait Issue

I am trying to use LaunchApplication or LaunchAppAndWait to run SQLCMD but am having the hardest time getting it to do anything. Below is the code I am using:

LaunchApplication:

sSQLCMD = PROGRAMFILES ^ "\\Microsoft SQL Server\\Client SDK\\ODBC\\130\\Tools\\Binn\\SQLCMD.EXE";
sLogFullName = PROGRAMFILES64^"Logs"^"ScriptIAmRunning.log";
sScriptRun = SUPPORTDIR ^ "ScriptIAmRunning.sql";
sParameters = '-E -S'+sSQLServer+' -i"'+sScriptRun+'" > "'+sLogFullName+'"';

nLaunchReturn = LaunchApplication(sSQLCMD, sParameters, "", SW_NORMAL, 10000, LAAW_OPTION_USE_SHELLEXECUTE | LAAW_OPTION_WAIT | LAAW_OPTION_USE_CALLBACK | LAAW_OPTION_HIDDEN );
if (nLaunchReturn = 0) then
MessageBox("App found", INFORMATION);
else
MessageBox("App not found", WARNING);
endif;


when I output it, it comes in correctly as:
C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\SQLCMD.EXE -E -Sservername\instancename -i"C:\Users\ME\AppData\Local\Temp\4\{120AB5C2-2753-4AEB-8B16-552E3ED03C68}\{4B2412FB-30BB-4839-A0C9-33F8A28BA28F}\ScriptIAmRunning.sql" > "C:\Program Files\Logs\ScriptIAmRunning.log"

I also tried:
nLaunchReturn = LaunchAppAndWait ( sSQLCMD, sParameters, LAAW_OPTION_WAIT | LAAW_OPTION_USE_CALLBACK | LAAW_OPTION_HIDDEN );
Labels (1)
0 Kudos
(1) Reply
rguggisberg
Level 13

What are you using for "In-Script Execution"?
Are you sequencing in "Install Exec Sequence"?
0 Kudos