博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Commands in Powershell
阅读量:4321 次
发布时间:2019-06-06

本文共 2237 字,大约阅读时间需要 7 分钟。

All commands are broken down into the command name, the parameters specified to the command, and the arguments to those parameters.

The first element in the command is the name of the command to be executed. The PowerShell interpreter looks at this name and determines what has to be done. It must figure out not only which command to run but which kind of command to run.

In PowerShell, there are four categories of commands:

  • cmdlets
  • shell function commands
  • script commands
  • native Windows commands.

Cmdlets

Cmdlet is a term that’s specific to the PowerShell environment. A cmdlet is implemented by a .NET class that derives from the Cmdlet base class in the PowerShell Software Developers Kit (SDK). This category of command is compiled into a dynamic link library (DLL) and then loaded into the PowerShell process, usually when the shell starts up. Because the compiled code is loaded into the process, it’s the most efficient category of command to execute.

 

Functions

Function is a named piece of PowerShell script code that lives in memory while the interpreter is running and is discarded on exit. Functions consist of user-defined code that’s parsed once when defined. This parsed representation is preserved so it doesn’t have to be reparsed every time it’s used.

 

Scripts

A script command is a piece of PowerShell code that lives in a text file with a .ps1 extension. These script files are loaded and parsed every time they’re run, making them somewhat slower than functions to start (although once started, they run at the same speed).

A script takes its name from the name of the file and is delimited by the file itself, so no braces are needed.

 

Native commands (applications)

Running a native command involves creating a whole new process for the command, native commands are the slowest of the command types. Also, native commands do their own parameter processing and so don’t necessarily match the syntax of the other types of commands. Native commands cover anything that can be run on a Windows computer, so you get a wide variety of behaviors. One of the biggest issues is when PowerShell waits for a command to finish but it just keeps on going.

转载于:https://www.cnblogs.com/fast-michael/archive/2012/11/21/2780509.html

你可能感兴趣的文章
《梦断代码》第四阶段阅读感想(包括第9、10、11共三章)
查看>>
OpenCV4Android 之 OpenCV4Android SDK
查看>>
serialVersionUID作用
查看>>
解决无法访问U盘打开提示拒绝访问的问题
查看>>
unicode 字符串。互相准换
查看>>
分组加密算法CBC模式的 Padding Oracle Attack 与 Hash算法的Length Extention Attack 小记...
查看>>
虚拟基类的初始化
查看>>
C++中析构函数为什么要是虚函数
查看>>
【转】记录pytty用户名和密码
查看>>
Django Rest Framework 视图和路由
查看>>
不忘初心,方得始终 ,让我们一起学习成长,感谢有你!
查看>>
InputControls的应用
查看>>
20190312_浅谈go&java差异(一)
查看>>
软件工程博客---团队项目---个人设计4(算法流程图)
查看>>
数据结构3——数组、集合
查看>>
坚定信心
查看>>
C++中 <iso646.h>头文件
查看>>
spring cloud: Hystrix(六):feign的注解@FeignClient:fallbackFactory(类似于断容器)与fallback方法...
查看>>
CISCO 动态路由(OSPF)
查看>>
vue.js实现移动端长按事件,处理长按事件和click事件冲突,长按安卓机支持震动...
查看>>