≡ Menu

Use powershell to know the given path is absolute or relative

Sometimes while writing powershell scripts, you might get a need to verify if the given path is absolute(c:tempmyfolders) or relative(..myfolders). You can easily run this test by using one of the dotnet provided method, IsPathRooted(). This method returns TRUE if the given path is absolute and will return FALSE if the given path is relative.

 Below is one classic example…



 Note that this won’t check whether the path you provided exists or not. You can read more about this method at 


{ 0 comments… add one }

Leave a Comment