Buradasın
PowerShell Current Directory Methods
sharepointdiary.com/2021/11/get-current-directory-script-path-in-powershell.htmlYapay zekadan makale özeti
- Understanding Current Directory
- Current directory is the folder where PowerShell environment is currently operating
- Relative paths start from current directory in PowerShell
- Current directory differs from PowerShell installation or user profile
- Main Methods
- Get-Location cmdlet returns current directory path including provider
- $PWD variable holds current working directory as PowerShell object
- [Environment]::CurrentDirectory property returns current directory path
- $PSScriptRoot variable shows directory where current script is located
- $MyInvocation variable contains script path and command line arguments
- Additional Information
- Current directory can be changed using Set-Location cmdlet
- Relative paths must consider current directory when working
- PowerShell provides error handling mechanisms for file access
- Multiple methods available for getting current directory regardless of console