Write Script File in Windows PowerShell

Q

How to write a script file in Windows PowerShell to run multiple commands together?

✍: FYIcenter.com

A

Writting a script file in Windows PowerShell is easy. You can follow these steps:

2. Write commands in Notepad with one command per line. For example:

```Write-Host "Hello World!"
test-connection www.microsoft.com -count 1 | format-list Address,ResponseTime
```

3. Save the script to a file called Hello.ps1.

4. Open a Windows PowerShell window.

5. Type in ".\Hello.ps1" at the command prompt. You will see two commands from the script file get executed:

```PS C:\fyicenter> .\Hello.ps1

Hello World!