zoukankan      html  css  js  c++  java
  • 如何通过其他工具的命令行启动PowerShell

    很多时候,我们需要在其他工具中启动PowerShell来执行PowerShell命令,比如Cmd.exe或批处理文件。下面就来介绍下启动PowerShell的基本语法。

    调用Windows PowerShell控制台基本语法:

    PowerShell[.exe]
    [-PSConsoleFile <file> | -Version <version>]
    [-EncodedCommand <Base64EncodedCommand>]
    [-ExecutionPolicy <ExecutionPolicy>]
    [-File <filePath> <args>]
    [-InputFormat {Text | XML}]
    [-NoExit]
    [-NoLogo]
    [-NonInteractive]
    [-NoProfile]
    [-OutputFormat {Text | XML}]
    [-Sta]
    [-WindowStyle <style>]
    [-Command { - | <script-block> [-args <arg-array>]
    | <string> [<CommandParameters>] } ]

    关于每个参数的含义,可以通过命令powershell -help来查看。

    举例:

    在一个命令提示符下或一个批处理文件中,可以用下列命令得到当前运行进程的列表:

    Powershell -nologo -noprofile -command get-process

    如果想使命令行执行powershell命令后保持运行不退出,可以增加-NoExit参数

    Powershell -noexit -command get-process

  • 相关阅读:
    set集合
    字典的使用与操作
    列表和字符串
    bzoj 4927: 第一题
    bzoj 3031: 理科男
    bzoj2263: Pku3889 Fractal Streets
    bzoj 1288: Neighbours
    bzoj2026: [SHOI2009]Coin
    bzoj3326: [Scoi2013]数数
    bzoj1494: [NOI2007]生成树计数
  • 原文地址:https://www.cnblogs.com/ITGirlXiaoXiao/p/2620036.html
Copyright © 2011-2022 走看看