How do I get Powershell to recognize the scripts local path?
I have, for example “test.htm” in the same folder as test.ps1 which contains
Get-Content .\test.htm
This is the error:
Get-Content : Cannot find path ‘C:\Users\some username\test.htm’ because it does not exist.
What is the proper way to reference a local file?
If by “local,” you mean local (i.e. a peer) to the running script then you should the following technique:
$psscriptrootis the folder the currently executing ps1 file resides in.