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

  • 相关阅读:
    MongoDB_聚合
    MongoDB_基本操作
    MongoDB_"Error parsing YAML config file: yaml-cpp: error at line 3, column 9: illegal map value"解决方法
    MongoDB_安装
    beautifulsoup模块
    python发送邮件
    selenium常用操作
    selenium元素定位
    requests模块的高级用法
    继承
  • 原文地址:https://www.cnblogs.com/ITGirlXiaoXiao/p/2620036.html
Copyright © 2011-2022 走看看