In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Let's start with the basics. You should know the basic command line commands, such as dir,cd,del, etc.
We have these commands in PowerShell, but they are a little different, and we can use them to be more powerful.
For example, dir c:\ windows, we will get a list of files and folders located under c:\ windows. We can use the same commands under PowerShell to achieve the same goal, but we can get more functionality in PowerShell.
In PowerShell, when we run a command, it returns more than just a list of files and folders in this case. With these objects, we can do anything we want.
Dir is actually an alias for a PowerShell command called the Get-ChildItem and PowerShell commands-to make our parameters a little different, we can allocate more with their output because they output objects, so if we want to get a list of directories under c:\ windows in PowerShell, we will use the following directory c:\ windows-directory.
Now we want to know the use of the-directory switch, and the answer is very simple:
There is a command called get-help-or its alias help-which will tell us all about any command in PowerShell
So if I'm going to run the help directory or get the help Get-Childitem or Get-Help directory or any combination, I'll get all the information I need. For this problem, I can run help and learn how to use the Get-Help command, which also has switches like-detailed or-examples, which even provide us with examples of how commands are allowed to be used.
So how do we read this help? let's take a look at the Get-Help directory.
Anything in square brackets [] is optional, for example, [- Recurse] is optional, we don't have to use it, but if we want dir to be recursive, we will need it. The values in are types that you can use, such as a word, an array of words separated by commas.
It is also optional in [- Exclude], but if we want to exclude some directories or files from the output, we must use the-Exclude file name, directory name, file name using this switch.
Sometimes you will see [[- Path]], because the [- Path] switch is in square brackets, and you can place values that have no switch meaning:
Dir-path c:\ windows and dir c:\ windows are the same
The important thing to remember is that we don't use switches, we have to save the order in which values are written, for example:
Get-ChildItem [[- Path]] [[- Filter]]
Get-childitem c:\ windows * .dll-will provide us with files / folders ending in .dll
Get-childitem-path c:\ windows-filter * .dll
Get-childitem-filter * .dll-path c:\ windows
It cannot be:
Get-childitem * .dll c:\ windows
Do we say dir is an alias for Get-ChildItem?
To answer this question, we can use Get-Alias to query
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.