From adc2177c52663d31c4506954093ce20f377f3f1b Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Sat, 14 Sep 2024 23:04:41 -0700 Subject: [PATCH] Use OS-agnostic Invoke-Item to trigger file explorer --- ArdisUtilities/ArdisUtilities.psm1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ArdisUtilities/ArdisUtilities.psm1 b/ArdisUtilities/ArdisUtilities.psm1 index e9b8a73..363979f 100644 --- a/ArdisUtilities/ArdisUtilities.psm1 +++ b/ArdisUtilities/ArdisUtilities.psm1 @@ -839,19 +839,19 @@ function Get-HelpAsMarkdown { function Open-ParentFolder { <# .SYNOPSIS - Opens File Explorer (explorer.exe) in the folder that contains a command. + Opens the native GUI file explorer (e.g., File Explorer on Windows) in the folder that contains a command. .DESCRIPTION Uses Get-Command to determine the path to an executable, then passes the path to Split-Path to get the - parent folder. Finally, opens the parent folder by passing the path as an argument to explorer.exe. + parent folder. Finally, opens the parent folder by passing the path as an argument to Invoke-Item. .PARAMETER Command - The name of the executable to open the File Explorer to. + The name of the executable to open the file explorer to. .EXAMPLE PS> Open-ParentFolder curl - Opens File Explorer to C:\Windows\system32\. + Opens file explorer to the folder containing the curl binary. #> [CmdletBinding()] @@ -865,7 +865,7 @@ function Open-ParentFolder { } process { - explorer.exe ((Get-Command $Command).Source | Split-Path -Parent) + Invoke-Item ((Get-Command $Command).Source | Split-Path -Parent) } } -- 2.47.3