]> git.ardis.lu - ArdisUtilities/commitdiff
Use OS-agnostic Invoke-Item to trigger file explorer
authorArdis Lu <ardisglu@gmail.com>
Sun, 15 Sep 2024 06:04:41 +0000 (23:04 -0700)
committerArdis Lu <ardisglu@gmail.com>
Sun, 15 Sep 2024 06:04:41 +0000 (23:04 -0700)
ArdisUtilities/ArdisUtilities.psm1

index e9b8a7330096f2b564196f432f1a2af86a5a367e..363979f80fc190497c1fe23745f671762e165932 100644 (file)
@@ -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)
   }
 }
 
This page took 0.051627 seconds and 4 git commands to generate.