2

I have a script like:

Filename: "{cmd}"; Parameters: "/C "" sqlcmd -S {code:ServerName}  -U {code:UserLOG} """ ; \
    Flags: nowait    skipifsilent

How can I keep the console window until user sees it?

I need to show the user the result of the operation on that console window.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Sandy Nomy
  • 87
  • 1
  • 10
  • If you want to output the result to **file** or something else, this [link](https://stackoverflow.com/questions/1136770/how-to-get-an-output-of-an-execed-program-in-inno-setup) might help. – Alanight Jan 02 '18 at 04:06

2 Answers2

3

Use pause Windows command, like:

Filename: "{cmd}"; Parameters: "/C ""sqlcmd ... & pause"""; Flags: nowait skipifsilent

Note that you actually do not need to run sqlcmd via cmd.exe ({cmd}). You can run it directly. But to combine the sqlcmd with the pause, you need the cmd.exe.


If the command itself needs spaces (like if you need to use {app}\MyProg.exe), use this syntax:

Filename: "{cmd}"; Parameters: "/C """"{app}\MyProg.exe"" ... & pause"""; ...
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
2

If you call cmd /K... instead of cmd /C... your install script opens a new console (inside the console window) which doesn't close automatically and must be closed by the user. Thus, you're able to read the output.

You can find the full list of parameters at: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cmd

Jejos
  • 103
  • 1
  • 5
  • 1
    That's a [good simple approach for debugging](https://stackoverflow.com/q/37324386/850848). But not a good idea for end-user-experience. – Martin Prikryl Dec 17 '18 at 19:59