I'm looking for a way to get the my local path that includes any camel cases that are used in the names. The primary reason is so I can use the same path to make a call in windows wsl. For example, in windows I can call a file as
c:\FoO\bar.txt
c:\Foo\Bar.txt
and windows will display it as c:\foo\bar.txt
. When I try to enter the WSL with bash I need to know the actual path since Linux is case sensitive.
I have tried using
$PSScriptRoot
Split-path C:\FoO\Bar.txt
(get-Item c:\Foo\Bar.txt).FullName
but they will only provide the path that to call the script.
How do I get my path as it's displayed in the windows os?
I can't just call the full path of the file I need since I can't guarantee the root directory it starting from. I also don't want to burn up cycles doing a find.
What you want is to look at the Target
property you get back from Get-Item
. Fullname
will come back however you typed it initially, but Target
is actually a code property that seems to get the raw path of the object.
(get-Item c:\Foo\Bar.txt).Target