1

To install our program we need to run batch file (which installs the whole application) which prompt user with few questions and we provide answer in "yes/no" format. I am writing a script and within the script I'm calling that batch file to install the whole program. Now what I am thinking to do is hide the console during installation and provide all the answers through the script.

skr
  • 1,700
  • 1
  • 15
  • 39
  • This is pretty broad question. What part of the flow are you having problems with? 1) How to ask user in the Inno Setup script? 2) How to pass the answers to the batch file? 3) How to process the answers in the batch file? – Martin Prikryl Mar 23 '15 at 08:04
  • Thanks Martin for your response. i just wanted to know How to pass the answers to the batch file when it ask for the input from the user and is it possible to create a checkbox for those question on the main UI which can do the same job provide the answers at runtime. – skr Mar 23 '15 at 13:03
  • Sorry, but you didn't answer my question. Anyway, I've tried to answer. The answer is as vague as your question. – Martin Prikryl Mar 23 '15 at 13:30

1 Answers1

1

The simplest solution is to modify the batch file to do what you want it to do, without asking.


If you cannot do this (e.g. if the batch file is 3rd-party) you have to redirect its input from a text file.

Create a text file with the answers (e.g. answers.txt):

y
n
y
y

Create a wrapper batch file that runs your installation batch and redirects its input from the answers file (wrapper.bat):

@echo off
install.bat < answers.txt

Install all files and let Inno Setup run the wrapper.bat:

[Files]
Source: "install.bat"; DestDir: "{app}"
Source: "wrapper.bat"; DestDir: "{app}"
Source: "answers.txt"; DestDir: "{app}"

[Run]
Filename: "{app}\wrapper.bat"; Flags: runhidden
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • Thanks Martin it really works but is there any chances that the install.bat could read some null value from answers.txt because m getting some error at the end. – skr Mar 24 '15 at 11:38
  • Martin is it possible to provide the input to the batch file from Inno script because i dont want to use wrapper.bat file if i do so i wont be able to hide my install.bat file because runhidden flag would hide only wrapper.bat file. – skr Mar 25 '15 at 06:25
  • *getting some error at the end*: That's pretty vague. *because runhidden flag would hide only wrapper.bat file* That's not true. Did you even try? – Martin Prikryl Mar 25 '15 at 06:28