>>* Do NOT indent (or use Beautify on) these TEXT/ENDTEXT blocks as it will mess up the results >>TEXT to m.RegCommands TEXTMERGE NOSHOW >>REGEDIT4 >><<m.InstallHKey>> >>"AppDirectory"="<<m.InstallAppDirectory>>" >>"Application"="<<m.InstallApplication>>" >>"HostName"="<<m.DefaultHostName>>" >>"Port"="<<m.DefaultPort>>" >>"BackupDirectory"="<<m.DefaultBackupDirectory>>" >>"DataDirectory"="<<m.DefaultDataDirectory>>" >>"PromptDirectory"="<<m.DefaultPromptDirectory>>" >>"Switch"="<<m.DefaultSwitch>>" >>ENDTEXT >> >> * Create the REG file >> m.RegFilename = '"' + JUSTPATH(application.servername) + [\EMPS.REG] + '"' >> STRTOFILE(m.RegCommands,m.RegFilename) >> >> * Initialize the variable that will hold the BAT file commands >> m.InstallBatchCommands = '' >> >>* Do NOT indent (or use Beautify on) these TEXT/ENDTEXT blocks as it will mess up the results >>TEXT to m.InstallBatchCommands TEXTMERGE NOSHOW >>NET STOP EMPS >>SC delete "EMPS" >><<m.instsrvFilename>> "EMPS" <<m.srvanyFilename>> >>REGEDIT.EXE /S <<m.RegFilename>> >>ENDTEXT >> >> * Create the BAT file >> m.InstallBatchFilename = '"' + JUSTPATH(application.servername) + '\EMPS_Install.bat' + '"' >> STRTOFILE(m.InstallBatchCommands,m.InstallBatchFilename) >> >> * Run the BAT file >> RUN /N &InstallBatchFilename >> >> * Give the batch file time to run >> m.TimePause = DATETIME() + 3 >> DO WHILE DATETIME() < m.TimePause && Wait 3 seconds... >> ENDDO >>>
>RUN /N ( m.InstallBatchFilename )
>
I found that using SLEEP 5 in the batch file just before running the REG file worked fine. I think that the instsrv and srvany process were taking some time. Don't know why that would be the case, but the SLEEP worked. If you have any ideas why, I would love to hear them.