官术网_书友最值得收藏!

The scripter's secret weapon – tab completion

Although Get-Command is a great way to find cmdlets, the truth is that the PowerShell cmdlet names are very predictable. In fact, they're so predictable that after you've been using PowerShell for a while you won't probably turn to Get-Command very often. After you've found the noun or the set of nouns that you're working with, the powerful tab completion found in both the PowerShell console and the ISE will allow you to enter just a part of the command and press tab to cycle through the list of commands that match what you have entered. For instance, in keeping with our examples dealing with services, you could enter *-Service at the command line and press tab. You would first see Get-Service, followed by the rest of the items in the previous screenshot as you hit tab. Tab completion is a huge benefit for your scripting productivity for several reasons, such as:

  • You get the suggestions where you need them
  • The suggestions are all valid command names
  • The suggestions are consistently capitalized

In addition to being able to complete the command names, tab completion also gives suggestions for parameter names, property, and method names, and in PowerShell 3.0 and above, it gives the parameter values. The combination of tab completion improvements and IntelliSense in the ISE is so impressive that I recommend that people upgrade their development workstation to at least PowerShell 3.0, even if they are developing PowerShell code that will run in a 2.0 environment.

主站蜘蛛池模板: 德格县| 朝阳市| 太仆寺旗| 温泉县| 乾安县| 都昌县| 宁明县| 措勤县| 苗栗县| 泰州市| 含山县| 临朐县| 汤原县| 武川县| 梨树县| 准格尔旗| 定襄县| 江北区| 四子王旗| 涟源市| 建湖县| 通渭县| 靖安县| 呼玛县| 德阳市| 乌兰察布市| 绥中县| 台山市| 临城县| 新乡市| 哈密市| 奉贤区| 栾川县| 朔州市| 昌宁县| 临泉县| 宣汉县| 汕头市| 灵台县| 方正县| 贵溪市|