Open Current Folder in PowerShell

When working in a PowerShell terminal session, you might want to open Windows Explorer to view the current directory.

This guide is a simple guide to demo how to open the current working directory directly from PowerShell.

Using Invoke-Item to Open the Current Folder

The Invoke-Item cmdlet lets you open files, folders, or other items. To open the current working directory in Windows Explorer, use a single . to reference the current path.

# Open current folder in windows explorer
Invoke-Item .
Invoke-Item PowerShell

You can also use the shorthand ii as an alias for Invoke-Item. This is helpful for quickly opening the current directory or a specified file path.

## ps script to open the current folder
write-output 'Opening current folder...' 
ii .
Run power shell script

Running this script will open the current directory in Windows Explorer after displaying a message, as shown in the screenshot above.

That’s it for this one, hope it was useful for you, cheers!


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Posts
Categories
Tags

Always On Availability Groups (AAG) (4) AWS (4) AWS Redshift (6) Database Admin (72) Database Backups & Recovery (14) Database Mirroring (2) Error Messages (5) Failover Cluster Instances (FCI) (1) Git Commands (6) Importing & Exporting Data (2) Linked Servers (3) Linux Administration (2) Logging & Monitoring (1) Microsoft Patching (2) MySQL (4) Postgres (6) PowerShell Scripts (2) SQL Certificates & Encryption (3) SQL Server Agent (5) SQL Server CDC (2) SQL Server Data Types (2) SQL Server Management Studio (SSMS) (16) SQL Server Networking (3) SQL Server on Linux (1) SQL Server Patching (2) SQL Server Performance Tuning (6) SQL Server Processes (SPIDs) (7) SQL Server Replication (2) SQL Server Scripts (13) SQL Server Security (4) SQL Server Storage (10) Windows Admin (21) Windows Authentication (2) Windows Automation (1) Windows Events (2) Windows Firewall (4) Windows Subsystem for Linux (WSL) (18)