Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Split-Path -LiteralPath BUG?

84 views
Skip to first unread message

ioioio322

unread,
Jul 4, 2009, 2:50:41 PM7/4/09
to

So it seems I found 3 bugs now... so I just want to start by saying I'm
not looking for bugs. Powershell is great.

Split-Path is a great tool and seems to work even with complex paths
such as:
$pathA = 'G:\X_HASH_TEST A\cat5 - hH 42 � � [�ő�] -- (�ű�) -
� , 34]23 [4\cat5 - hH 42 � � [�ő�] -- (�ű�) - � , 34234.txt'

$temp = Split-Path $pathA -Parent


The above works great. But the path is "complex"..... so one would
think that the -LiteralPath parameter would be a good idea.

Unfortunately:
$temp = Split-Path -LiteralPath $pathA -Parent

does not work! It seems there is a bug in the -LiterPath
implementation for this specific function (Split-Path).

Yet... it does seem to take paths literaly even though -LiteralPath is
not specified... interesting. On TechNet it states that Split-Path is
supposed to have -LiteralPath option.

Any ideas what is going on? Is this different in Powershell v2?

I am using Powershell v1.


--
ioioio322

Bob Landau

unread,
Jul 4, 2009, 4:45:01 PM7/4/09
to
I really wish you would explain what "doesn't work" means.

This is what I see using the build of v2 that comes with Win7 RC

PS C:\Users\robertla.CONTINUUM> split-path $pathA -Parent
C:\X_HASH_TEST A\cat5 - hH 42 á é [óőö] -- (úűü) -í , 34]23 [4
PS C:\Users\robertla.CONTINUUM> split-path $pathA -Leaf
cat5 - hH 42 á é [óőö] -- (úűü) - í , 34234.txt
PS C:\Users\robertla.CONTINUUM> $pathA
C:\X_HASH_TEST A\cat5 - hH 42 á é [óőö] -- (úűü) -í , 34]23 [4\cat5 - hH 42
á é [óőö] -- (úűü) - í
, 34234.txt

Both of these variantions work correctly the only thing I changed was drive
letter since I don't have G

However
PS:> Split-Path -LiteralPath $PathA

doesn't work correctly for this build of Powershell 6.1.7100.0. The cmdlet
will prompt you for the -Path this most definitely is a bug. The reason can
be seen by typing

PS:> help split-path -parameter path

You will find this to be a required paremeter which renders literalpath
quite useless.


"ioioio322" wrote:

>
> So it seems I found 3 bugs now... so I just want to start by saying I'm
> not looking for bugs. Powershell is great.
>
> Split-Path is a great tool and seems to work even with complex paths
> such as:

> $pathA = 'G:\X_HASH_TEST A\cat5 - hH 42 á é [óőö] -- (úűü) -
> í , 34]23 [4\cat5 - hH 42 á é [óőö] -- (úűü) - í , 34234.txt'

0 new messages