How to create and run a PowerShell script in Windows 10 and 11

Jugo Mobile
By
Jugo Mobile
Jugo Mobile is a platform dedicated to high-quality content in gaming, sports, and tech. Engage with high-quality content and connect with fellow enthusiasts and experts. Explore...
5 Min Read

PowerShell is an excellent programming language that allows you to interact with various Windows components. With PowerShell scripts, you can modify and work with the Registry, file system, group policies, system settings, and more. If you are someone who wants to automate tasks on your Windows PC, PowerShell is the best place to start your journey. So, in this guide, we give you a basic introduction on how to create and run a PowerShell script in Windows 10 and 11.

Create a PowerShell script with Notepad

  • Open Pad from the Start menu.
  • Now we are going to use a simple Start-Process command to open “beebom.com” in Chrome.
Start-Process chrome.exe "beebom.com"
start a process using powershell command in notepad
  • To create a PowerShell script, click “File” and choose “Save as“.
save as file option in notepad
  • Name the file and make sure add “.ps1 at the end to turn it into an executable PowerShell script. I have named it script.ps1 and saved the file to the desktop.
save a file as a PowerShell script (.ps1) in Windows
  • To run the PowerShell script, right-click the script.ps1 file and choose “Run with PowerShell“.
run PowerShell script from Windows 11 context menu
  • That’s all. A Chrome window (or whatever your default browser is) will open and the website will launch. This is a basic example how to create a PowerShell script and run it.
Windows 11 desktop interface with Jugo Mobile website launched in Chrome

Run a PowerShell script from PowerShell or CMD

  • You can also run the script from a PowerShell terminal. Open PowerShell o Terminal from the Start menu. You do not need administrator privileges to run a script.
  • Now, run the following command to allow PowerShell to execute scripts. This will allow PowerShell run local scripts. If the first command shows an error, run the second command.
Set-ExecutionPolicy RemoteSigned

either,

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
change execution policy in powershell to allow local scripts
  • Next, move to location where you have saved the script using the CD domain.
cd Desktop
  • After that, run the command as follows. Begin with “.\ and add the file name (without space) along with the .ps1 extension. Now, press Enter.
.\script.ps1
run a PowerShell script from the PowerShell command line
  • This will execute the PowerShell script from the Terminal window. In this case, a browser window will open and the website will start.
  • You can also turn on a Symbol of the system window to run a PowerShell script. Run the command as follows.
cd Desktop
powershell .\script.ps1
run powershell script from cmd

Create and run scripts with PowerShell ISE

Windows 10 and 11 come with PowerShell ISE (Integrated Scripting Environment) that allows you to write PowerShell code and run it in an integrated environment seamlessly. It works like any other IDE and supports code indentation and many other modern features. This is how you can use it.

  • Open the Start menu and search for “PowerShell ISE“. Now, open it.
open powershell ise from windows 11 start menu
  • Then in the top panel you can write the code and it will run in the bottom panel.
PowerShell ISE interface
  • To demonstrate a basic example, I have written the following code that generates “Hello, world!” in the PowerShell terminal.
Write-Host "Hello, World!"
  • To run the code, simply click the “Run” button in the top toolbar. You can see the result in the Terminal below.
sample program to run in powershell ISE
  • Here’s another basic example. Run it and this show current date and time.
$dateandtime = Get-Date -Format "dd-MM-yyyy HH:mm:ss"
Write-Host "The current date and time is: $dateandtime"
find current date and time using PowerShell ISE scripts
  • For more information on PowerShell scripts, you can go to Excellent documentation from Microsoft. here.

So, this is how you can create and run a PowerShell script in Windows 11 and 10. PowerShell is a great scripting language for Microsoft to interact with the operating system and do things from the command line. We have already written a useful tutorial on how to automate tasks in Windows 10 to save time using Task Scheduler and PowerShell commands. Make sure to check it out.

Aside from that, if you are a Terminal addict, learn how to customize Windows Terminal to give it a new look. Anyway, that’s all from us. If you still have any questions, let us know in the comments section below.

Share This Article
Follow:
Jugo Mobile is a platform dedicated to high-quality content in gaming, sports, and tech. Engage with high-quality content and connect with fellow enthusiasts and experts. Explore the latest trends and innovations in our vibrant community. Join us and experience the future today!
Leave a Comment
Grow your brand and reach a larger audience. Advertise with us today and get noticed by thousands.
© 2025 Jugo Mobile. All Rights Reserved.