Build: v5.6.157
OS: Windows 10 Enterprise (64 Bit)
Build: v10.0.16299.0
Since last update when i utilise the snippet Get-ScriptDirectory
Code: Select all
function Get-ScriptDirectory
{
[OutputType([string])]
param ()
if ($null -ne $hostinvocation)
{
Split-Path $hostinvocation.MyCommand.path
}
else
{
Split-Path $script:MyInvocation.MyCommand.Path
}
}
$hostinvocation
$ScriptDirectory = Get-ScriptDirectory
$ScriptDirectory
Code: Select all
ERROR: Split-Path : Impossible de lier l'argument au paramètre « Path », car il a la valeur Null.
ERROR: Au caractère C:\Users\<username>\Documents\SAPIEN\PowerShell Studio\Files\test9.ps1:31 : 14
ERROR: + Split-Path $hostinvocation.MyCommand.path
ERROR: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR: + CategoryInfo : InvalidData : (:) [Split-Path], ParameterBindingValidationException
ERROR: + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.SplitPathCommand
ERROR:
When i run in console it return something like this (yes with the pointy at the beginning of the line)
."C:\Users\<username>\Documents\SAPIEN\PowerShell Studio\Files\test9.ps1"