0

EDIT: I can't find the solution but Martin's method looks like only solution for this situation.

I am trying to execute about 30-40 command line parameters. I don't want to separate commands with "&&" because it looks very complex all of these codes in one line.

[Run]
Filename: "{cmd}"; Parameters: "/c mkdir ""{app}\Folder1"" && mkdir ""{app}\Folder2"" && mkdir     
""{app}\Folder3"" mkdir ""{app}\Folder4"" && mkdir ""{app}\Folder5"" && mkdir ""{app}\Folder6"" && mkdir ""{app}\Folder7"""

As you can see it looks so complex.

(mkdir command is example. Each commands are different in my project.)

How can I achieve it?

I can use .cmd or .bat file and run it but don't want it because I want to see progress bar on installer. My commands takes some time to finishing executing.

Waiting for helps, thanks!

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • You don't need to do any ot that the way you are. Use PascalScript and do it all directly from a code block in the installer itself. – Ken White Jul 14 '19 at 14:57
  • There are many existing posts here about creating folders in InnoSetup using PascalScript. Have you made any effort to find them yet? – Ken White Jul 14 '19 at 15:39
  • That doesn't matter. You can do a whole lot of things in PascalScript in Inno Setup. I don't know what else you're trying to do, but again there are **lots** of examples of scripting in Inno Setup on this site. Have you made **any effort at all** to search for them yet? – Ken White Jul 14 '19 at 16:00
  • You wrote that you do not want to use a batch file, because you want to see a progress bar. Yet you put all commands to a single command line, so the effect is the same as if you use the batch file. You won't see any progress. It's *one command*. Your question makes no sense. – Martin Prikryl Jul 15 '19 at 08:23
  • This is why i am asking how can i avoid using "single command line"? It looks so complex. How can i line break between codes etc. – user4997999 Jul 15 '19 at 16:14
  • What solution you cannot find? What are you missing? – Martin Prikryl Jul 17 '19 at 07:03
  • To read better this comment: http://prntscr.com/og4s16 if exist a.txt ( if exist b.txt ( copy x y copy z y copy c y ) ) For example i can't write this cmd code block in inno-setup with multiple lines. i need to put in if exist inside an if exist. I need to write like this to make it work; if exist a.txt ( if exist b.txt ( copy x y && copy z y && copy c y && ) ) This might look simple but my project is more complex than this example codes so writing in 1 line is a nightmare for this situation. – user4997999 Jul 17 '19 at 07:11
  • 1) `if exist a.txt if exist b.txt copy x y` 2) `if exist a.txt if exist b.txt copy z y`, etc. You can use Inno Setup preprocessor to avoid repeating the code. – Martin Prikryl Jul 17 '19 at 07:24
  • I downloaded inno setup preprocessor but i don't exactly understand how it can help me about avoiding repeating codes? – user4997999 Jul 17 '19 at 09:43
  • Sorry, but this is getting too broad. If you want our help, you need to post a good question in the first place. – Martin Prikryl Jul 17 '19 at 09:47
  • Sorry for that. I think i need to ask another question about how to minimize code using with inno setup preprocessor. – user4997999 Jul 17 '19 at 09:57
  • Yes, that's a good idea. – Martin Prikryl Jul 17 '19 at 10:14

1 Answers1

0

If you want to execute multiple commands standalone, add separate entry to the [Run] section for each command:

[Run]
Filename: "{cmd}"; Parameters: "/c mkdir ""{app}\Folder1""
Filename: "{cmd}"; Parameters: "/c mkdir ""{app}\Folder2""
Filename: "{cmd}"; Parameters: "/c mkdir ""{app}\Folder3""
Filename: "{cmd}"; Parameters: "/c mkdir ""{app}\Folder4""
Filename: "{cmd}"; Parameters: "/c mkdir ""{app}\Folder5""
Filename: "{cmd}"; Parameters: "/c mkdir ""{app}\Folder6""
Filename: "{cmd}"; Parameters: "/c mkdir ""{app}\Folder7""

Though for creating folders, there's a dedicated [Dirs] section:

[Dirs]
Name: "{app}\Folder1"
Name: "{app}\Folder2"
Name: "{app}\Folder3"
Name: "{app}\Folder4"
Name: "{app}\Folder5"
Name: "{app}\Folder6"
Name: "{app}\Folder7"
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • Looks like only solution is this. But this is not exactly what i was looking for. For example check out this; if exist asd.txt ( copy asd.txt "folder1" mkdir folder2 copy "folder1\asd.txt" "folder1\..\folder2" ) see? i need to write all this lines in same line to execute it on inno setup. but in bat or cmd file i can put a ine break so code will look less complex. i cant write if exist command under multiple [Run] commands – user4997999 Jul 15 '19 at 21:02
  • Is there an option to skip next line to continue reading code in inno setup Run section? Like putting a character " \ " – user4997999 Jul 15 '19 at 21:12
  • Of course that you can use `if exist` in Inno Setup. But you have to use it for each command separatelly, if you want the progess bar. – Martin Prikryl Jul 15 '19 at 21:18