-1

I want to execute a powershell script file, it works but if I am in the same path that the script

....
$toto=(Get-ChildItem -Path "C:\Users\toto\Desktop\titi\tutu)

I work with the variable $toto

I execute the script from :

 PS C:\Users\toto\Desktop\titi> C:\Users\toto\Desktop\titi\script.ps1 = it works

but when I am below s subdir, not knowing the current "working directory" :

 C:\Users\toto\Desktop\ C:\Users\toto\Desktop\titi\script.ps1

how to resolve that please

4

1 回答 1

0

我猜你需要这样的东西:

$toto=(Get-ChildItem -Path "$PSScriptRoot\tutu")
于 2019-12-05T15:25:28.977 回答