Running multiple instances of the same script

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 7 years and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
Interstellar
Posts: 6
Last visit: Wed Dec 21, 2016 9:28 am

Running multiple instances of the same script

Post by Interstellar »

I have a PS script - PScript and several files that need to be processed - Text1, Text2, and Text3. What I would like to do is run multiple instances of the same script - one for each of the text files. Is it as simple as doing something like this?

powershell Pscript Text1 & powershell Pscript Text2 & powershell Pscript Text3

Thanks!
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Running multiple instances of the same script

Post by jvierra »

You will find that that doesn't work.

You will have to use a separate line to run each script or use jobs. The jobs will need to take an argument that specifies the file to process.
User avatar
Interstellar
Posts: 6
Last visit: Wed Dec 21, 2016 9:28 am

Re: Running multiple instances of the same script

Post by Interstellar »

Thank you for pointing me in the right direction. I'm reading up about jobs now.
jvierra wrote:You will find that that doesn't work.

You will have to use a separate line to run each script or use jobs. The jobs will need to take an argument that specifies the file to process.
This topic is 7 years and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked