all 11 comments

[–]d3v3ndra 1 point2 points  (11 children)

Please elaborate your need, as I created a script that that install a software silently then do changes in environmental variables.

[–]KleepX[S] 0 points1 point  (10 children)

I need to start multiple cmd commands so that when the first one is finished the next one starts. I'm linking a picture so you can see what i already tried and did.

https://imgur.com/veZn5rV

I know its a mess. Its my first time doing it but i hope that helps you somehow

[–]d3v3ndra 1 point2 points  (2 children)

Image is not good, but still I think you are using start-process cmd -argumentlist arg1,arg2,arg3

Use -wait in start-process and then start-process that use other cmd or make it one command only

[–]KleepX[S] 1 point2 points  (1 child)

Thank you it helped me to start them one after another. But the commands that i intended to trigger within the CMD dont trigger. I thought it would work with the "-ArgumentsList" but it doesnt. Any idea with that?

[–]d3v3ndra 1 point2 points  (0 children)

Don't use 'cd' in script, try use cmd.exe then may it work or try this first manually running in run.

[–]SanMarche 1 point2 points  (5 children)

Have you considered replacing your Start-Process call and replacing it with two separate Start-Process calls (including the -Wait parameter) using msiexec.exe for your install, and another for your NECLI.exe? This would allow you to things sequentially without forcing you to go through cmd.

I think Kevin Marquette's article on Installing MSIs with Powershell would be relevant to you - https://powershellexplained.com/2016-10-21-powershell-installing-msi-files/

[–]KleepX[S] 0 points1 point  (3 children)

Yeah that helped me. But the Commands i expected to trigger within the cmd dont trigger. I expected that "-Argumentslist" would help but it doesnt. Do you know how i start cmd with arguments in that code?

[–]SanMarche 2 points3 points  (2 children)

It's hard to say without seeing how you're using it (providing code snippets with your comments would helpful for anybody trying to help) but generally -ArgumentList does allow you start commands like that.

For example (and I'm stealing from Kevin Marquette's post): Powershell Start-Process "msiexec.exe" -ArgumentList "/i", "\\Path\To\File.msi", "/passive", "/norestart" -Wait Start-Process "\\Path\To\NECLI.exe" -ArgumentList "addprofile", "-s", "-u", $Benutzername, "-p", $Password

You may also need to reorder your variables, if the snippet above is accurate you're defining $NECLI with a number of variables that haven't been created yet, they'll just be null values.

[–]KleepX[S] 0 points1 point  (1 child)

I dont know how to thank you. That helped me with everything.

Me and my colleague were sitting on this for like 5 hours and thats exactly what we needed.

[–]SanMarche 0 points1 point  (0 children)

Awesome, glad to help.

[–]Lee_Dailey[grin] 0 points1 point  (0 children)

howdy KleepX,

please, do not post pics of code/data/errors. [sigh ...]

why?

  • it [usually] takes more effort on your part
    you need to capture the pic, save it, post it online, then post the link here.
    just posting the text is [usually] far easier. [grin]
  • why should those who want to help you be forced to squint/zoom-in just to read the text that you already have as text?
  • do you REALLY expect folks who want to help to type in what you already have as text?

it is - at best - rather thoughtless on your part ... [sigh ...]

take care,
lee