PowerShell Tutorial
This is a example based tutorial for PowerShell, in the most concise way.
PowerShell How-To. Table of Contents
This chapture Covers the most common tasks for interactive use, with focus on standalone sample code that you can use right away.
Install and Help
- Download, Install
- Start PowerShell
- Exit, Abort
- Print Version
- Builtin Help
- Name Completion
- List of Aliases
- Find Command
- Case Sensitivity
List Files
- List Files
- Show Fullpath, No Truncate Lines
- List Empty Files 📜
- Count Number of Files
- List Files by Wildcard Name Pattern
- Filter File Name by Regular Expression
- List File by Size
- Sort Files by Size 📜
- List Files by Date Time
- Search Text in Files (grep)
Directory Operations
- Navigate Directory
- Show Current Dir Path
- List Directories
- Show Directory as Tree
- List Empty Dir 📜
- Dir Size 📜
File Operations
- Copy File
- Rename File
- Move File
- Delete File
- Create New File
- Set File Read Only Attribute
- Create File Symbolic Link, Hard Link, Junction
- Get File Content
- Join Files
- Compare Files (Show Difference)
- Open File by Default App
- File Date Time
File Properties, Attributes, Permission
- File Attributes
- List All Possible File Attribute Values
- Show a File's Attributes
- Show Hidden Files
- List Files with Specific Attribute
- Set a File's Attributes
- File Attributes Object Type
Windows config
- Environment Variable
- Session Environment Variable
- Environment Variable in Registry
- Show Path Environment Variable
- Set Path Environment Variable
Zip Tar
Misc
Coding pwsh. Table of Contents
This chapter covers fundamental concepts of PowerShell for writing PowerShell scripts.
File Name Extension
Comment
Object and Type
Path
Pipe
Number
String
- String
- Single Quoted String
- Double Quoted String
- Here-String
- Escape Characters
- String Length
- Join String
- Split String
- Format String
- String Methods
- String Wildcards
- Regular Expression Operators
- Regex Result ($Matches)
- Regular Expression Syntax
Variable
Boolean
Conditional
Data Structure
Array
- Array
- Array Sub-Expression Operator, Collection to Array
- Array and Types
- Nested Array, Multi-Dimensional Array
- Array, Get Items
- Array, Set Item
- Test If Collection Contains a Value
- Join Array, Append
- Filter Array (where)
- Delete Array, Clear Array
- Array to String
- Array Methods
- Iterate Array
Hashtable, Dictionary
- Hashtable, Dictionary
- Hashtable: Get Key Value, Add, Remove
- Join Hashtables
- Hashtable Key / Property Name Clash
- Hashtable Get All Keys
- Sort Hashtable
- Hashtable Methods
- Iterate Hashtable
Loop, Iteration
Input, Output
Function
- Define Function
- Function Return Value and Statement
- Function Parameters
- Define Function to Accept Pipe
- Function Inline Doc
- Allowed Characters in Function Name
Error
Profile and Script
- Profile (init file)
- Create a Script
- Load a Script
- Eval Variable, String, ScriptBlock
- Get Current Script Path
Misc
Xah PowerShell Scripts
Testimonial
