9

I am having the below commands in a batch file. While i try to run it using Execute action in Finalbuilder project, 1st command alone was run. So, i planned to have each commands in various batch files. Could anyone please help me to run all the commands in a single batch file run with the delay (if required)?

Commands:

   dnvm list
   dnvm install 1.0.0-beta8
   dnvm use 1.0.0-beta8 –p
   dnvm -Args alias default 1.0.0-beta8

Also i am getting the below error when run the last command through batch file using Execute action in FinalBuilder project.

Error: Invoke-Expression: Positional parameter cannot be found that accepts argument

Karthi
  • 575
  • 2
  • 10
  • 29

2 Answers2

18
call dnvm list
call dnvm install 1.0.0-beta8
call dnvm use 1.0.0-beta8 –p
call dnvm -Args alias default 1.0.0-beta8

call will execute the target then return to the following line of the batch when it terminates.

Magoo
  • 77,302
  • 8
  • 62
  • 84
  • Hi Magoo, third command is not running. Can you please help on this? I think, 3rd command is skipped. – Karthi Jan 22 '16 at 09:53
  • -p is not recognized when i run bat file with all the commands. But, when i run the 3rd command alone in a bat file with the following content, it is working. dnvm use 1.0.0-beta8 $–p – Karthi Jan 22 '16 at 09:58
  • I have no idea what `dnvm` is or how it interprets arguments. – Magoo Jan 22 '16 at 11:07
  • This should be the accepted answer, certainly saved me some good amount of time. – Biplob Biswas Sep 05 '17 at 08:08
0

You can try appending "START /WAIT" in front of every line. Like this:

START "" /WAIT "dnvm list"
START "" /WAIT "dnvm install 1.0.0-beta8"
START "" /WAIT "dnvm use 1.0.0-beta8 –p"
START "" /WAIT "dnvm -Args alias default 1.0.0-beta8"
lobiZoli
  • 199
  • 9
  • It is not working. As i said earlier, only the first command was executed. – Karthi Jan 21 '16 at 11:57
  • I'm surprised that does anything at all. `Start` considers the first set of quotes it sees to be the window title, so you need to put `""` before `/WAIT`. – SomethingDark Jan 21 '16 at 12:10
  • 2
    @lobiZoli, while it may show as an optional parameter in the help file I can't even tell you how many times I have had a batch file fail when trying to run certain executable files without an empty set of quotes. – Squashman Jan 21 '16 at 13:40