View Single Post
Old 06-21-2007   #2 (permalink)
dreeschkind


 
 

RE: how do I keep powershells current directory and dotnets current di

I know this came up before. Maybe a workaround has already been posted here
or in the old newsgroup microsoft.public.windows.server.scripting some month
ago. I'm not quite sure, but AFAIK there is no easy solution for this.
Using a new custom "cd" function that can sync the current directory might
be a solution. Note that you need to filter out directories on drives like
env: hklm: cert: etc. as they can not be used as
[system.Environment]::CurrentDirectory.

--
greetings
dreeschkind

"Harald Ums (2179630)" wrote:

> System.IO.FileInfo and every dotnet function has a current directory, that
> is different from what powershell thinks is the current directory.
>
> [system.Environment]::CurrentDirectory = (convert-path ".")
>
> puts it in sync once, but after every cd everything is wrong again
> Calling Convert-Path before using a dotnet function is extremely tedious and
> error prone.
>
> Harald
>
>

My System SpecsSystem Spec