Monthly Archives

June 2012

PowerShell

Powershell: Get Execution Path of Script

I have been writing a script which generated a report. I had used Out-File to write to a file and this had been working as expected for some time. Today however, I opened up PowerShell and entered the path of the script without changing directory to the script location first. This caused the report file to be written to a directory other than the script itself. I quite like having the report and script in the same directory as it keeps it all together. So I thought, how do I insure the script writes the report file where it's being…
Chris Colden
June 1, 2012