Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista Tutorial - how do I keep powershells current directory and dotnets current directory in sync

Reply
 
Old 06-21-2007   #1 (permalink)
Harald Ums \(2179630\)
Guest


 
 

how do I keep powershells current directory and dotnets current directory in sync

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
Old 06-21-2007   #2 (permalink)
dreeschkind
Guest


 
 

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
Reply

Thread Tools


Similar Threads
Thread Forum
How can I Write-Host the current directory? PowerShell
Difference in getting the current exe directory .NET General
bug in join-path when the current directory is used PowerShell
Executing scripts in the current directory PowerShell
Manipulating current directory as a variable PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46