Introduction to PowerShell
Introduction to PowerShell
Fundamentals of PowerShell
Introduction
A scripting language is a computer language that uses some instructings referred to as commands. Those commands are submitted to a computer, namely an operating system, to automatically perform some tasks. To perform such tasks, Microsoft created a scripting language named PowerShell. Actually, PowerShell is just one more version from a long line of previous scripting languages. In this series of lessons, we will learn how to use PowerShell to automate some tasks in Microsoft Windows operating systems.
Installing PowerShell
Before using PowerShell, you must have installed it in your computer. If you are using Microsoft Windows 10 or higher, it should have been installed with the operating system. If not, you download it freely from the Microsoft websites. You must then install it.
Starting PowerShell
To use PowerShell, you have many options. The primary way to use PowerShell is to launch it from the Start menu:
One way is to click PowerShell. In some cases, you will have to start PowerShell as an administrator. In that case, you would right-click PowerShell and click Run As Administrator:
After starting PowerShell, it would display like a DOS window with a command prompt:
PowerShell and Visual Studio Code
Although there are various ways you can use PowerShell from its own command prompt, Microsoft provide Visual Studio Code as a viable alternative. You can freely download it and install it on your computer. There are various ways you can use PowerShell in Visual Studio Code. As one option, like PowerShell provides a command prompt, Visual Studio Code is equipped with a terminal that you can user. As another or better option, you can create a PowerShell file in Visual Studio Code and execute it. To do that, you must install. In fact, if you create a PowerShell file and try to execute it in Visual Studio Code, you would receive a message box stating: "Do yo want to install the recommended 'PowerShell' extension from Microsoft for the PowerShell language?";
In that case, click Install. The installation would then occur:
Once that installation has been completed, you can use PowerShell in either the PowerShell prompt or in Visual Studio Code.
PowerShell and a Text Editor
One more option to use PowerShell is by using a text editor such as Notepage. To do that, you can write your code in Notepad and save it. You can then access that file from either the command prompt or Visual Studio code.
Using PowerShell
A PowerShell Line
There are various ways you can use PowerShell. The primary way to use PowerShell is to write a line or PowerShell code and execute it. To do that, after starting PowerShell, at its command prompt, type the line of code. To execute, press Enter. In the same way, you can launch Visual Studio Code. On its main menu, click Terminal and click New Terminal:
In that terminal, you can type a line of code. To execute it, press Enter.
|
|||
Home | Copyright © 2024-2025, FunctionX | Saturday 02/02/2025, 18:45 | Next |
|