murray Posted March 14, 2007 Report Posted March 14, 2007 If i execute c:\scritps\project\script.ps1 (when I'm standing in c:\) and the first line in that script is .\config.ps1 it wont work since config.ps1 is located in c:\scritps\project Therefore I want to do a "pwd" for the script.ps1 execution dir... How to?!
marco.shaw Posted March 14, 2007 Report Posted March 14, 2007 A few things you can do: 1. Add c:\scritps\project to your path, then you can just call "config.ps1", instead of ".\config.ps1" or other. 2. Hardcode c:\scritps\project\config.ps1 in your original script.
SilverTech Posted March 14, 2007 Report Posted March 14, 2007 I know what you want: Split-Path -Path $MyInvocation.MyCommand.Definition -Parent then if u run c:\test\script.ps1 from c:\ the output will be c:\test
Recommended Posts
Archived
This topic is now archived and is closed to further replies.