PowerShell concurrency Control-command-line parameter four questions

Source: Internet
Author: User

The preacher asked:

How to get the process command line, and command line parameters under win?

Missionary Answer:

You can use this PowerShell command (which is actually a WMI query):

(get-wmiobject-query "SELECT * from Win32_Process"). CommandLine

The preacher asked:

I think this is very uncomfortable, why? In the Task Manager, the "command Line" column (Task Manager-point Details---name---"Right-click---" SELECT Column---"Select the command line),

But the get-process command in PowerShell has no. commandline property?

Missionary Answer:

Yes, but now just wait for the PowerShell MVP, eat People's rice to pull a bit of human excrement, with Microsoft appeal.

The preacher asked:

How do I get the number of script concurrency under win? and the number of process concurrency?

Can detect any process, such as EXE. You can detect the concurrency of any (extension) script. But the sense of the foot with WMI is a bit awkward.

Missionary Answer:

#检测ps脚本进程并发数. ps1[string]$ want to detect the Run script name = ' txt e-reader v3.ps1 ' $ current User under _ command line for all commands = (get-wmiobject-query "SELECT *  from Win32_Process "). commandline# run under current user rights, the current user is obtained. Administrator permissions to run, get all users. $ detected script Process concurrency = 0foreach ($temp 001 in $ current user under _ command line for all commands) {    if ($temp 001-like "*$ want to detect run script name *")    {$ detected script process Concurrent number + +}}write-host "detected script process concurrency number    $ detected script process concurrency"

PowerShell Missionary original article 2015-10-17 permitted reprint, but must retain the name and provenance, otherwise investigate legal liability

The preacher asked:

Win under Get script concurrency number, what is the pinch?

Missionary Answer:

The ability to get the number of concurrent scripts is still more commonly used.

For example, I have a CPU core 4, I want to let the script 4 process run. Each process is a script, each script, by passing parameters to the script, giving it a task block.

So I can use Task Scheduler + a PS script to check the number of script concurrency on a regular basis. If the task block that is distributed to a script runs out, that script exits, you can increase the Script task process.

PowerShell concurrency Control-command-line parameter four questions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.