Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fb4eba5

Browse files
small trim on the intro, made some progress in the ps general intro
1 parent 8c43223 commit fb4eba5

File tree

4 files changed

+40
-28
lines changed

4 files changed

+40
-28
lines changed

‎Docs/Intro/CoreElements_Intro.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ In simple terms:
7070

7171
By default, Windows is shipped with conhost.exe, short for Console Host. This application is the default terminal application built into Windows that hosts command-line shells like Command Prompt and PowerShell, providing a basic interface for executing commands. First appeared in Windows 7, this terminal is super old, and in [this article](https://learn.microsoft.com/en-us/windows/console/definitions), Microsoft says that even though "conhost.exe will continue to be responsible for API call servicing and translation," "the user-interface components are intended to be delegated through a pseudoconsole to a terminal."
7272

73-
Anyway, my point is that if you want to do some proper scripting and interaction with the terminal, conhost.exe is not recommended. There are a lot more other options that are far better than conhost.exe, here is a incomplete list just for example:
73+
Anyway, my point is that if you want to do some proper scripting and interaction with the terminal, conhost.exe is not recommended. There are a lot more other options that are far better than conhost.exe, here is an incomplete list just for example:
7474

7575
- [Hyper](https://hyper.is)
7676
- [ConEmu](https://conemu.github.io)
@@ -85,9 +85,9 @@ In this project, I am using Windows Terminal, and I recommend you to use it too,
8585

8686
Now that you have learned the basics about the operating system, shell, and terminal. For more advanced information on related concepts, you can also visit Scott Hanselman's article: [What's the difference between a console, a terminal, and a shell?](https://www.hanselman.com/blog/whats-the-difference-between-a-console-a-terminal-and-a-shell)
8787

88-
You are ready to move on and start using the tools in this project. Don’t worry if you are still new - each tool comes with step-by-step setup guides to help you get started. You can use the following link to head back to the README.
88+
You are ready to move on and start using the tools in this project. Don’t worry if you are still new. Each tool comes with step-by-step setup guides to help you get started. You can use the following link to head back to the main README.
8989

90-
👉 [Tools Overview section](../../README.md#tools-overview)
90+
👉 [Continue from where you left](../../README.md#understanding-the-command-line)
9191

9292
---
9393

‎Docs/Intro/PowerShell_Intro.md

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# A Brief Introduction to PowerShell
22

3-
This document is my attempt at providing a comprehensive introduction to PowerShell to beginners. The document mainly introduces PowerShell's key features and advantages to provide reasons to try out PowerShell. Explanations of some basic scripting and programming concepts are also included. If you found the explanation of any of the concepts confusing, or some key concepts are missing in this document. Please leave an issue, and I will try my best to produce a clear explanation.
3+
This document is my attempt at providing a comprehensive introduction to PowerShell to beginners. The document mainly introduces PowerShell's key features and advantages to provide reasons to try out PowerShell. Explanations of some basic scripting and programming concepts are also included. If you found the explanation of any of the concepts confusing, or some key concepts are missing in this document. Please [leave an issue](https://github.com/Alexander-556/PowerShellScripts/issues/new), and I will try my best to produce a clear explanation.
44

55
---
66

@@ -24,35 +24,37 @@ This document is my attempt at providing a comprehensive introduction to PowerSh
2424
- [Error Handling](#error-handling)
2525
- [Cmdlets to try](#cmdlets-to-try)
2626
- [Basic Cmdlets](#basic-cmdlets)
27+
- [File Operation](#file-operation)
28+
- [Pipeline Practice](#pipeline-practice)
2729
- [Feedbacks](#feedbacks)
2830

2931
## What is PowerShell?
3032

31-
[PowerShell](https://learn.microsoft.com/en-us/powershell/scripting/overview?view=powershell-7.5) is a powerful automation platform developed by Microsoft. It combines a command-line shell with a robust scripting language, all built on the .NET runtime. In our case, PowerShell allows us to automate tasks and solve everyday Windows annoyances with ease, thanks to its deep integration with the operating system.
33+
[PowerShell](https://learn.microsoft.com/en-us/powershell/scripting/overview?view=powershell-7.5) is a powerful automation platform developed by Microsoft. It combines a shell with a robust scripting language, all built on the .NET runtime. In our case, PowerShell allows us to automate tasks and solve everyday Windows annoyances with ease, thanks to its deep integration with the operating system.
3234

3335
## PowerShell vs. Command Prompt: Key Differences
3436

35-
Most Windows users are more familiar with the Command Prompt (cmd.exe) - the black box that handles basic commands like `dir`, `copy`, `ping`, or `ipconfig`. Its history goes all the way back to the MS-DOS days. While CMD has served well for decades, it's showing its age in today’s more complex computing environment. PowerShell, on the other hand, is a modern, more powerful tool designed to meet today’s automation needs.
37+
Most Windows users are more familiar with the Command Prompt (cmd.exe), the black box that handles basic commands like `dir`, `copy`, `ping`, or `ipconfig`. Its history goes all the way back to the MS-DOS days. While CMD has served well for decades, it's showing its age in today’s more complex computing environment. PowerShell, on the other hand, is a modern, more powerful tool designed to meet today’s automation needs.
3638

3739
Here are some key advantages of PowerShell over Command Prompt:
3840

3941
### Object-based input/output
4042

41-
PowerShell doesn't just deal with plain text. It works with structured objects, which means the output from one command can be passed to another with full access to properties and values.
43+
PowerShell doesn't just deal with plain text. It works with structured objects, which means the output from one command can be passed to another with full access to properties and values. This feature allows for superior coding flexibility.
4244

4345
### Modern scripting capabilities
4446

45-
PowerShell supports variables, conditional logic, loops, functions, modules, and robust error handling - everything you’d expect from a full scripting language.
47+
PowerShell supports variables, conditional logic, loops, functions, modules, and robust error handling, all the tools you will need and everything you would expect from a full scripting language.
4648

4749
### Standardized command naming and built-in help
4850

49-
PowerShell uses a consistent [Verb-Noun format](https://learn.microsoft.com/en-us/powershell/scripting/developer/cmdlet/approved-verbs-for-windows-powershell-commands?view=powershell-7.5) like `Get-Process` or `Set-TimeZone`. This makes it easier to guess, discover, and remember commands. Plus, the [Get-Help](https://learn.microsoft.com/en-us/powershell/scripting/learn/ps101/02-help-system?view=powershell-7.5) command provides detailed syntax, parameter explanations, and usage examples — all available right from the terminal.
51+
PowerShell uses a consistent [Verb-Noun format](https://learn.microsoft.com/en-us/powershell/scripting/developer/cmdlet/approved-verbs-for-windows-powershell-commands?view=powershell-7.5) like `Get-Process` or `Set-TimeZone`. This makes it easier to guess, discover, and remember commands. Plus, the [Get-Help](https://learn.microsoft.com/en-us/powershell/scripting/learn/ps101/02-help-system?view=powershell-7.5) command provides detailed syntax, parameter explanations, and usage examples right from the terminal.
5052

5153
---
5254

5355
Combined with PowerShell's native integration into Windows, we can write scripts that easily interact with files, scheduled tasks, system settings, event logs, services, and even the registry. This opens up a wide range of possibilities for system automation and customization.
5456

55-
I hope the above paragraphs have given you enough reasons to at least give PowerShell a try. In the following sections, we’ll go over some of PowerShell’s core concepts - the building blocks that will help you become confident with this tool.
57+
I hope the above paragraphs have given you enough reasons to at least give PowerShell a try. In the following sections, we’ll go over some of PowerShell’s core concepts, the building blocks that will help you become confident with this tool.
5658

5759
If you're ever curious to explore further, Microsoft has an excellent, beginner-friendly documentation site here:
5860
👉 [Microsoft PowerShell Documentation](https://learn.microsoft.com/en-us/powershell/scripting/how-to-use-docs?view=powershell-7.5)
@@ -75,7 +77,7 @@ For more details, on Cmdlets, go visit Microsoft's official documentation on:
7577

7678
#### Functions
7779

78-
PowerShell lets you define your own functions to group reusable blocks of code under a custom name. This is especially helpful when you want to make your code modular by encapsulate logic that you might use multiple times throughout a script. Functions are written using the function keyword and can accept parameters just like cmdlets.
80+
PowerShell lets you define your own functions to group reusable blocks of code under a custom name. This is especially helpful when you want to make your code modular by encapsulate logic that you might use multiple times throughout a script. Functions are written using the `function` keyword and can accept parameters just like cmdlets.
7981

8082
As you grow more comfortable with scripting, writing your own functions becomes second nature and gives your scripts more structure and clarity. For more detailed information on functions, check out the following links to Microsoft's official PowerShell documentations:
8183
👉 [About Functions](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_functions?view=powershell-7.5)
@@ -92,25 +94,25 @@ More details on modules can be found at Microsoft's official documentation:
9294

9395
### Pipelines
9496

95-
Similar to Unix-like shells (like Bash or Zsh), PowerShell also supports the use of pipelines using the | operator. This operator lets you pass the output of one command directly into another, making it possible to chain commands together in a clean and readable way.
97+
Similar to Unix-like shells (like Bash or Zsh), PowerShell also supports the use of pipelines using the `|` operator. This operator lets you pass the output of one command directly into another, making it possible to chain commands together in a clean and readable way.
9698

97-
The pipeline is especially handy when writing compact, powerful one-liners - allowing you to filter, sort, and transform data step by step, all in a single command.
99+
The pipeline is especially handy when writing compact, powerful one-liners, allowing you to filter, sort, and transform data step by step, all in a single command.
98100

99101
👉 [About Pipelines](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_pipelines?view=powershell-7.5)
100102

101103
### General Programming Concepts
102104

103-
In addition, PowerShell isn't just a command-line shell - it's a scripting language, and it supports many features common to other programming languages:
105+
In addition, PowerShell isn't just a command-line shell. It's a scripting language, and it supports many features common to other programming languages:
104106

105107
#### Variables
106108

107-
You can store values in variables using the \$ sign (e.g., $value = 1). Variables can hold strings, numbers, arrays, and objects.
109+
You can store values in variables using the \$ sign (e.g., $value = 1). Variables can hold strings, numbers, arrays, and objects. Typically, scripting language don't require a type declaration when you initialize the variable, and the type is usually determined during the interpretation of the code.
108110

109111
#### Control Flow
110112

111-
PowerShell gives you access to if statements, loops (for, foreach, while), and switch cases - all the tools you need to make your scripts smarter and more dynamic.
113+
PowerShell gives you access to if statements, loops (for, foreach, while), and switch cases. These are all the control flow tools you would expect from a programming language.
112114

113-
Check out PowerShell's key works with the following link:
115+
Check out PowerShell's key words with the following link:
114116
👉 [About Keywords](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_language_keywords?view=powershell-7.5)
115117

116118
### PowerShell-Specific Concepts
@@ -128,8 +130,8 @@ Get-Help Get-Process
128130
This above command will show you a detailed explanation of the `Get-Process` cmdlet, including its description, parameters, and usage examples. You can also use these helpful flags:
129131

130132
```powershell
131-
Get-Help Get-Process -Examples # Show practical examples
132-
Get-Help Get-Process -Detailed # Show detailed information
133+
Get-Help Get-Process -Examples # Show examples
134+
Get-Help Get-Process -Detailed # Show some detailed information
133135
Get-Help Get-Process -Online # Open the official docs in your browser
134136
```
135137

@@ -157,8 +159,14 @@ or visit the [Microsoft Approved Verbs Documentation](https://learn.microsoft.co
157159

158160
Since we are usually directly communicating with the Windows Operating System, proper error handling becomes very important to us. When writing automation scripts, we don't want fatal errors to come uncaught, and we also don't want a stream of "Unexpected Error" during debugging. That could be a nightmare. Luckily, PowerShell provides structured error handling using try, catch, and finally blocks. You run code that might go wrong in the try block. If some error occurred in the try block, code in the catch block will execute. Code in Finally block will always execute regardless of the error state. This allows you to build robust scripts that can customize error message and handle unexpected problems without crashing.
159161

162+
While just reading about these features could be boring. I suggest you to try these `try`, `catch`, and `finally` code blocks when you are comfortable with scripting. Just explore their behavior and you will see the value of these seemingly simple code blocks.
163+
160164
## Cmdlets to try
161165

166+
_Work in Progress..._
167+
168+
To give you a helpful start in using PowerShell, here are some example cmdlets that you can easily try after you set up your PowerShell environment
169+
162170
### Basic Cmdlets
163171

164172
```powershell
@@ -179,6 +187,10 @@ Set-Location C:\Users
179187

180188
Navigates to a different folder (like cd in CMD or Bash).
181189

190+
### File Operation
191+
192+
### Pipeline Practice
193+
182194
---
183195

184196
## Feedbacks

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /