Computer
Programming
For Beginners
Quick Start Guide
Tutorial Book 3
Ray Yao
Copyright 2015 by Ray Yao
All Rights Reserved
Neither part of this book nor whole of this book may be reproduced or transmitted in any form or by any means electronic, photographic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without prior written permission from the author . All rights reserved !
Ray Yao
About the Author: Ray Yao
Certified PHP engineer by Zend, USA
Certified JAVA programmer by Sun, USA
Certified SCWCD developer by Oracle, USA
Certified A+ professional by CompTIA, USA
Certified ASP . NET expert by Microsoft, USA
Certified MCP professional by Microsoft, USA
Certified TECHNOLOGY specialist by Microsoft, USA
Certified NETWORK+ professional by CompTIA, USA
www . amazon . com/author/ray-yao
In 8 Hours eBooks & Books on Amazon
Advanced C++ in 8 Hours
Advanced Java in 8 Hours
AngularJs in 8 Hours
C# in 8 Hours
C# Q & A
C++ in 8 Hours
C++ Q & A
Django in 8 Hours
Go in 8 Hours
Html Css in 8 Hours
Html Css Q & A
Java in 8 Hours
Java Q & A
JavaScript in 8 Hours
JavaScript Q & A
JQuery in 8 Hours
JQuery Q & A
Kotlin in 8 Hours
Linux Command Line
Linux Q & A
MySql in 8 Hours
Node . Js in 8 Hours
Perl in 8 Hours
Php MySql in 8 Hours
Php Q & A
PowerShell in 8 Hours
Python in 8 Hours
Python Q & A
R in 8 Hours
Ruby in 8 Hours
Rust in 8 Hours
Scala in 8 Hours
Shell Scripting in 8 Hours
Swift in 8 Hours
Visual Basic in 8 Hours
Visual Basic Q & A
Xml Json in 8 Hours
Preface
Computer Programming covers all essential computer language knowledge . You can learn complete primary skills of computer programming fast and easily .
The book includes six crash courses, such as PowerShell, Node.js, Django, Scala, Swift, Perl.
Note:
This book is only for computer programming beginners, it is not suitable for experienced computer programmers .
Source Code for Download
This book provides source code for download; you can download the source code for better study, or copy the source code to your favorite editor to test the programs .
Table of Contents
PowerShell
Hour 1
Introduction
What is PowerShell?
PowerShell is a command-line script environment running on a Windows machine for automate system and application management . You can think of it as an extension of the command line prompt cmd . exe . PowerShell is built on the . net platform, and all that are passed by the command are . net objects . PowerShell fully supports the use of objects . It is readable, easy to use, and powerful . From Window 7 to now, various operating systems have built-in PowerShell platforms .
Currently there are five versions of PowerShell:
Operating Systems | Versions: |
Windows Vista or Windows Server 2008 | PowerShell . 0 |
Windows 7 or Windows Server 2008 R2 | PowerShell . 0 |
Windows 8 or Windows Server 2012 | PowerShell . 0 |
Windows . 1 or Windows Server 2012 R2 | PowerShell . 0 |
Windows 10 or Windows Server 2016 | PowerShell . 0 |
On August 18, 2016, Microsoft announced that the open source, cross-platform version of PowerShell will support multiple operating systems including Windows, MacOS, CentOS and Ubuntu . It is called PowerShell Core and runs on . net Core .
Start PowerShell
Method 1:
Click Start > Windows PowerShell
Method 2:
Click Start > Type PowerShell in the Search field .
Method 3:
Click Start > Type PowerShell in the Run field .
Method 4:
Click Start > All Programs > Accessories > Windows PowerShell .
After you start the PowerShell, you can see a blue screen .
PowerShell Commands
The format of Powershell command is verb - noun.
The syntax to check the PowerShell commands is as follows:
Example 1.1
PS C:\Users\RAY> Get-Command CommandType Name ----------- ---- Alias Add-ProvisionedAppxPackage Alias Apply-WindowsUnattend |
Explanation:
CommandType: There are three command types in PowerShell:
1 . Alias: another name of the command .
2 . Function: the command is used for a function .
3 . Comlet: a powerful PowerShell command, its parameter is a . net object .
Note:
. For easier reading, we will omit PS C:\Users\RAY> in later page s .
. The PowerSell commands will be shown in bold type in later page s .
Get Command Alias
The syntax to get the command alias is as follows:
Get-Command -CommandType Alias |
Example 1.2
Get-Command -CommandType Alias CommandType Name ----------- ---- Alias % - > ForEach-Object Alias ? - > Where-Object Alias ac - > Add-Content .. |
Explanation:
The alias of the ForEach-Object is %.
The alias of the Where-Object is ?
The alias of the Add-Content is ac
By the way, the alias of the Get-Command is gcm.
Note:
. For easier reading, we will omit PS C:\Users\RAY> in later page s .
. The PowerSell commands will be shown in bold type in later page s .
Get Commands with Verb
The syntax to get some commands with the specified verb is as follows:
Get-Command verb Specified-Verb |
Example 1.3
Get-Command -verb Clear CommandType Name ----------- ---- Function Clear-BitLockerAutoUnlock Function Clear-Disk Function Clear-DnsClientCache Function Clear-FileStorageTier Function Clear-Host Function Clear-StorageDiagnosticInfo Cmdlet Clear-Content Cmdlet Clear-EventLog Cmdlet Clear-History |
Explanation: Get-Command -verb Clear gets the commands with Clear verb.
Get Commands with Noun
The syntax to get some commands with specified noun is as follows:
Get-Command -noun Specified-Noun |
Example 1.4
Get-Command -noun Service CommandType Name ----------- ---- Cmdlet Get-Service Cmdlet New-Service Cmdlet Restart-Service Cmdlet Resume-Service Cmdlet Set-Service Cmdlet Start-Service Cmdlet Stop-Service Cmdlet Suspend-Service |