Skip to main content
ubuntuask.com

Back to all posts

How to Open an Selected Object With Powershell?

Published on
3 min read
How to Open an Selected Object With Powershell? image

Best PowerShell Tools to Buy in October 2025

1 Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools

Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools

BUY & SAVE
$47.34 $59.99
Save 21%
Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools
2 Beginner’s Guide to PowerShell Scripting: Automate Windows Administration, Master Active Directory, and Unlock Cloud DevOps with Real-World Scripts and Projects

Beginner’s Guide to PowerShell Scripting: Automate Windows Administration, Master Active Directory, and Unlock Cloud DevOps with Real-World Scripts and Projects

BUY & SAVE
$0.99
Beginner’s Guide to PowerShell Scripting: Automate Windows Administration, Master Active Directory, and Unlock Cloud DevOps with Real-World Scripts and Projects
3 Troubleshooting SharePoint: The Complete Guide to Tools, Best Practices, PowerShell One-Liners, and Scripts

Troubleshooting SharePoint: The Complete Guide to Tools, Best Practices, PowerShell One-Liners, and Scripts

BUY & SAVE
$27.00 $59.99
Save 55%
Troubleshooting SharePoint: The Complete Guide to Tools, Best Practices, PowerShell One-Liners, and Scripts
4 AWS Tools for PowerShell 6: Administrate, maintain, and automate your infrastructure with ease

AWS Tools for PowerShell 6: Administrate, maintain, and automate your infrastructure with ease

BUY & SAVE
$48.99
AWS Tools for PowerShell 6: Administrate, maintain, and automate your infrastructure with ease
5 Learn PowerShell Toolmaking in a Month of Lunches

Learn PowerShell Toolmaking in a Month of Lunches

BUY & SAVE
$20.52 $44.99
Save 54%
Learn PowerShell Toolmaking in a Month of Lunches
6 Learn Windows PowerShell in a Month of Lunches

Learn Windows PowerShell in a Month of Lunches

BUY & SAVE
$34.99
Learn Windows PowerShell in a Month of Lunches
7 PowerShell Advanced Cookbook: Enhance your scripting skills and master PowerShell with 90+ advanced recipes (English Edition)

PowerShell Advanced Cookbook: Enhance your scripting skills and master PowerShell with 90+ advanced recipes (English Edition)

BUY & SAVE
$37.95
PowerShell Advanced Cookbook: Enhance your scripting skills and master PowerShell with 90+ advanced recipes (English Edition)
8 PowerShell for Sysadmins: Workflow Automation Made Easy

PowerShell for Sysadmins: Workflow Automation Made Easy

BUY & SAVE
$28.99
PowerShell for Sysadmins: Workflow Automation Made Easy
9 Learn Windows PowerShell in a Month of Lunches

Learn Windows PowerShell in a Month of Lunches

BUY & SAVE
$31.99 $44.99
Save 29%
Learn Windows PowerShell in a Month of Lunches
+
ONE MORE?

To open a selected object with PowerShell, you can use the Start-Process cmdlet. First, you need to identify the file path of the object you want to open. Once you have the file path, you can use the following command:

Start-Process -FilePath "C:\Path\To\Your\Object"

Replace "C:\Path\To\Your\Object" with the actual file path of the object you want to open. This command will launch the selected object using the default program associated with its file type.

How to open an application with PowerShell?

  1. Open PowerShell: Press Win + X and select Windows PowerShell from the menu that appears.
  2. Use the Start-Process cmdlet to open an application. The basic syntax is: Start-Process "path_to_application"

For example, if you want to open Notepad, you can use the following command: Start-Process "notepad.exe"

  1. Press Enter to execute the command. The application should now open.
  2. You can also specify additional parameters when opening an application. For example, to open a specific file with Notepad, you can use: Start-Process "notepad.exe" "path_to_file"
  3. To open an application with elevated privileges (as an administrator), you can add the -Verb RunAs parameter to the command: Start-Process "path_to_application" -Verb RunAs
  4. If you want to open a specific application with a specific window style (e.g., minimized or maximized), you can use the -WindowStyle parameter: Start-Process "path_to_application" -WindowStyle Maximized
  5. After you have successfully opened the application using PowerShell, you can close the application using the Task Manager or by using the Stop-Process cmdlet in PowerShell.

What is the script for opening multiple files in PowerShell?

To open multiple files in PowerShell, you can use the following script:

$files = "file1.txt", "file2.txt", "file3.txt"

foreach ($file in $files) { Invoke-Item $file }

In this script, you first define an array $files containing the paths of the files you want to open. Then, you use a foreach loop to iterate over each file in the array and use the Invoke-Item cmdlet to open each file.

What is the shortcut for opening a new instance of PowerShell?

To open a new instance of PowerShell, you can use the keyboard shortcut Ctrl + Shift + N.

How to open a text file with PowerShell?

To open a text file with PowerShell, you can use the Get-Content cmdlet. Here's how you can do it:

  1. Open a PowerShell window.
  2. Use the following command to open a text file:

Get-Content C:\path\to\your\file.txt

Replace C:\path\to\your\file.txt with the actual path to the text file you want to open.

This command will display the contents of the text file in the PowerShell window. You can also save the contents of the file to a variable or use it in other commands as needed.

What is the cmdlet for opening a PDF file in PowerShell?

There is no built-in cmdlet in PowerShell for opening a PDF file. You can use the Start-Process cmdlet to launch a PDF file with the default program associated with that file type.

For example:

Start-Process -FilePath "C:\path\to\your\file.pdf"

This will open the PDF file with the default PDF viewer on your system.