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 - bug in join-path when the current directory is used

Reply
 
Old 08-28-2007   #1 (permalink)
Bob Landau


 
 

bug in join-path when the current directory is used

1) Is there a FAQ either on this forum or connect.microsoft on what format to
use when submitting bugs?

2) Has someone previously posted a problem with how join-path handles the
current directory?


To give an example assume that the current directory of drive d: is Users


c: cd d:
d:\users

c: dir d:

d--- bob
....


Passing the following parameters to join-path does not return the expected
results. It should be dumping out the contents of my folder since its a child
of the Users directory.



c:>join-path d: bob | dir



The reason is join-path blindly adds the path-seperator when concatenating
the two parameters.

join-path should be checking whether the first parameter ends in a colon and
if so concatenate the parameter without the path-seperator.


thx
bob







My System SpecsSystem Spec
Old 08-28-2007   #2 (permalink)
Shay Levi


 
 

Re: bug in join-path when the current directory is used

1. You can submit a new bug or suggestion on Mcrosoft connect http://connect.microsoft.com
2. Can't remember
3. Mabe this can help - http://blogs.msdn.com/powershell/arc...join-path.aspx

HTH

Shay
http://scriptolog.blogspot.com


Quote:

> 1) Is there a FAQ either on this forum or connect.microsoft on what
> format to use when submitting bugs?
>
> 2) Has someone previously posted a problem with how join-path handles
> the current directory?
>
> To give an example assume that the current directory of drive d: is
> Users
>
> c: cd d:
> d:\users
> c: dir d:
>
> d--- bob
> ...
> Passing the following parameters to join-path does not return the
> expected results. It should be dumping out the contents of my folder
> since its a child of the Users directory.
>
> c:>join-path d: bob | dir
>
> The reason is join-path blindly adds the path-seperator when
> concatenating the two parameters.
>
> join-path should be checking whether the first parameter ends in a
> colon and if so concatenate the parameter without the path-seperator.
>
> thx
> bob

My System SpecsSystem Spec
Old 08-28-2007   #3 (permalink)
Kiron


 
 

Re: bug in join-path when the current directory is used

A work around:
join-path (get-item d bob | dir

....with alias
join-path (gi d bob | dir

--
Kiron
My System SpecsSystem Spec
Old 08-28-2007   #4 (permalink)
Bob Landau


 
 

Re: bug in join-path when the current directory is used

Thanks Kiron I didn't think of this work around. The one which I used when I
wrote a batchfile function to handle

embedded spaces
more than one backslash as part of the drive letter
and of course this issue was to do the check whether the drive was passed in
only

Adding a . to the drive will also work. c:.\


But all of these require one to parse the paths and take corrective action
which is what join-path is supposed to do.



"Kiron" wrote:
Quote:

> A work around:
> join-path (get-item d bob | dir
>
> ....with alias
> join-path (gi d bob | dir
>
> --
> Kiron
>
My System SpecsSystem Spec
Old 08-28-2007   #5 (permalink)
Kiron


 
 

Re: bug in join-path when the current directory is used

> Adding a . to the drive will also work. c:.\

That's a better (shorter) work around, you don't need the '\' after the dot
though

join-path d:. bob | dir

--
Kiron

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Why behaves Join-Path not the pythonic way PowerShell
How can I Write-Host the current directory? PowerShell
Difference in getting the current exe directory .NET General
how do I keep powershells current directory and dotnets current directory in sync PowerShell
Errors in Help file for join-path 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