如何在PowerShell中打开文件夹? 我不是在讲述如何在特定文件夹中启动PowerShell。
我的意思是,在powershell的命令行中,我想要打开一个文件夹,例如:"open document"
如何在PowerShell中打开文件夹? 我不是在讲述如何在特定文件夹中启动PowerShell。
我的意思是,在powershell的命令行中,我想要打开一个文件夹,例如:"open document"
使用Invoke-Item
命令,或其别名:ii。
PS> ii c:\windows # open the windows directory in windows explorer
PS> ii c:\book.xls # open book.xls in Excel
PS> ii . # open the current directory in windows explorer
start .
start c:\
要在Powershell中打开当前文件夹,请输入以下命令:
PS>> explorer.exe $(pwd)
使用Invoke-Item
,别名ii
:
ii d:\temp\
explorer.exe c:\temp\
explorer.exe <YourFolderPathHere>
还有需要考虑的因素:
PS C:\> ii -path c:\directory\directory\directory
如果您的文件名由两个单词组成并用空格隔开,请考虑使用单引号:
PS C:\> ii -path 'c:\directory\directory\directory directory\'
1. ii or invoke-item
2. explorer.exe
3. start
explorer.exe
后面加上一个点将会打开当前目录:explorer.exe .
@REM Open directory
@REM Version 1.0
@echo off
if [%1]==[] (powershell ii .
) Else (
powershell ii %1
cd %1
)
在Mac中,输入'open .'将打开当前目录,在Windows PowerShell中输入'start .'也会实现相同的功能。
我不太明白你想要什么,但我有两个可能的解决方案:
explorer .\Documents
或者
cd .\Documents