![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| Guest | Inconsistent behaviour when using set-location with different providers Try the following commands. I would be interesed if you can confirm the same inconsistencies in behaviour that I show below. There are three issues that I see: 1. Why does providing the provider name (or not) in the command affect what is displayed in the prompt? 2. Why is the behaviour of the FileSystem provider and Registry provider different? Is the inconsistency a bug? 3. Why does set-location C: and set-location FileSystem::C: take you to different folders? Bug? PS C:\Documents and Settings\Andrew Watt> set-location HKLM: PS HKLM:\> set-location C: So far so good. But when you provide the name of the provider it appears in the prompt. PS C:\Documents and Settings\Andrew Watt> set-location Registry::HKLM If you omit the colon with the FileSystem provider you can an error. PS Microsoft.PowerShell.Core\Registry::HKLM> set-location FileSystem::C Set-Location : Cannot find path 'C' because it does not exist. At line:1 char:13 + set-location <<<< FileSystem::C But it works with the colon in place. PS Microsoft.PowerShell.Core\Registry::HKLM> set-location FileSystem::C: Providing the colon with the Registry provider produces an error (the FileSystem equivalent worked). PS Microsoft.PowerShell.Core\FileSystem::C:\> set-location Registry::HKLM: Set-Location : Cannot find path 'HKLM:' because it does not exist. At line:1 char:13 + set-location <<<< Registry::HKLM: For convenience here are the commands with no interpolated comment: PS C:\Documents and Settings\Andrew Watt> set-location HKLM: PS HKLM:\> set-location C: PS C:\Documents and Settings\Andrew Watt> set-location Registry::HKLM PS Microsoft.PowerShell.Core\Registry::HKLM> set-location FileSystem::C Set-Location : Cannot find path 'C' because it does not exist. At line:1 char:13 + set-location <<<< FileSystem::C PS Microsoft.PowerShell.Core\Registry::HKLM> set-location FileSystem::C: PS Microsoft.PowerShell.Core\FileSystem::C:\> set-location Registry::HKLM: Set-Location : Cannot find path 'HKLM:' because it does not exist. At line:1 char:13 + set-location <<<< Registry::HKLM: PS Microsoft.PowerShell.Core\FileSystem::C:\> (get-childitem function rompt).definition'PS ' + $(Get-Location) + $(if ($nestedpromptlevel -ge 1) { '>>' }) + '> ' PS Microsoft.PowerShell.Core\FileSystem::C:\> For information here also is my prompt() function. It's the default. PS Microsoft.PowerShell.Core\FileSystem::C:\> (get-childitem function rompt).definition'PS ' + $(Get-Location) + $(if ($nestedpromptlevel -ge 1) { '>>' }) + '> ' PS Microsoft.PowerShell.Core\FileSystem::C:\> Can others confirm the behaviour? Do you see the differences as desirable? Andrew Watt MVP |
My System Specs![]() |
| | #2 (permalink) |
| Guest | RE: Inconsistent behaviour when using set-location with different prov Andrew I've tried them and got the same results. I think it should be consistent. As more providers are added to PowerShell inconsistencies like this will become more of an irritant and will put people off. -- Richard Siddaway Please note that all scripts are supplied "as is" and with no warranty "Andrew Watt [MVP]" wrote: > Try the following commands. I would be interesed if you can confirm > the same inconsistencies in behaviour that I show below. > > There are three issues that I see: > > 1. Why does providing the provider name (or not) in the command affect > what is displayed in the prompt? > > 2. Why is the behaviour of the FileSystem provider and Registry > provider different? Is the inconsistency a bug? > > 3. Why does set-location C: and set-location FileSystem::C: take you > to different folders? Bug? > > PS C:\Documents and Settings\Andrew Watt> set-location HKLM: > PS HKLM:\> set-location C: > > So far so good. But when you provide the name of the provider it > appears in the prompt. > > PS C:\Documents and Settings\Andrew Watt> set-location Registry::HKLM > > If you omit the colon with the FileSystem provider you can an error. > > PS Microsoft.PowerShell.Core\Registry::HKLM> set-location > FileSystem::C > Set-Location : Cannot find path 'C' because it does not exist. > At line:1 char:13 > + set-location <<<< FileSystem::C > > But it works with the colon in place. > > PS Microsoft.PowerShell.Core\Registry::HKLM> set-location > FileSystem::C: > > Providing the colon with the Registry provider produces an error (the > FileSystem equivalent worked). > > PS Microsoft.PowerShell.Core\FileSystem::C:\> set-location > Registry::HKLM: > Set-Location : Cannot find path 'HKLM:' because it does not exist. > At line:1 char:13 > + set-location <<<< Registry::HKLM: > > For convenience here are the commands with no interpolated comment: > > PS C:\Documents and Settings\Andrew Watt> set-location HKLM: > PS HKLM:\> set-location C: > PS C:\Documents and Settings\Andrew Watt> set-location Registry::HKLM > PS Microsoft.PowerShell.Core\Registry::HKLM> set-location > FileSystem::C > Set-Location : Cannot find path 'C' because it does not exist. > At line:1 char:13 > + set-location <<<< FileSystem::C > PS Microsoft.PowerShell.Core\Registry::HKLM> set-location > FileSystem::C: > PS Microsoft.PowerShell.Core\FileSystem::C:\> set-location > Registry::HKLM: > Set-Location : Cannot find path 'HKLM:' because it does not exist. > At line:1 char:13 > + set-location <<<< Registry::HKLM: > PS Microsoft.PowerShell.Core\FileSystem::C:\> (get-childitem > function rompt).definition> 'PS ' + $(Get-Location) + $(if ($nestedpromptlevel -ge 1) { '>>' }) + > '> ' > PS Microsoft.PowerShell.Core\FileSystem::C:\> > > For information here also is my prompt() function. It's the default. > > PS Microsoft.PowerShell.Core\FileSystem::C:\> (get-childitem > function rompt).definition> 'PS ' + $(Get-Location) + $(if ($nestedpromptlevel -ge 1) { '>>' }) + > '> ' > PS Microsoft.PowerShell.Core\FileSystem::C:\> > > Can others confirm the behaviour? Do you see the differences as > desirable? > > Andrew Watt MVP > |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: Inconsistent behaviour when using set-location with different providers The answer is quite simple -- "c:" and "filesystem::c:" are two different paths. The first is the *name* of a PSDrive (e.g. "C") which happens to look the same as a windows filesystem root drive , the second is a provider direct path, which specifies the provider and the root for said provider. The second is _equivalent_ to the first, but is not the same powershell path. - Oisin Andrew Watt [MVP] wrote: > Try the following commands. I would be interesed if you can confirm > the same inconsistencies in behaviour that I show below. > > There are three issues that I see: > > 1. Why does providing the provider name (or not) in the command affect > what is displayed in the prompt? > > 2. Why is the behaviour of the FileSystem provider and Registry > provider different? Is the inconsistency a bug? > > 3. Why does set-location C: and set-location FileSystem::C: take you > to different folders? Bug? > > PS C:\Documents and Settings\Andrew Watt> set-location HKLM: > PS HKLM:\> set-location C: > > So far so good. But when you provide the name of the provider it > appears in the prompt. > > PS C:\Documents and Settings\Andrew Watt> set-location Registry::HKLM > > If you omit the colon with the FileSystem provider you can an error. > > PS Microsoft.PowerShell.Core\Registry::HKLM> set-location > FileSystem::C > Set-Location : Cannot find path 'C' because it does not exist. > At line:1 char:13 > + set-location <<<< FileSystem::C > > But it works with the colon in place. > > PS Microsoft.PowerShell.Core\Registry::HKLM> set-location > FileSystem::C: > > Providing the colon with the Registry provider produces an error (the > FileSystem equivalent worked). > > PS Microsoft.PowerShell.Core\FileSystem::C:\> set-location > Registry::HKLM: > Set-Location : Cannot find path 'HKLM:' because it does not exist. > At line:1 char:13 > + set-location <<<< Registry::HKLM: > > For convenience here are the commands with no interpolated comment: > > PS C:\Documents and Settings\Andrew Watt> set-location HKLM: > PS HKLM:\> set-location C: > PS C:\Documents and Settings\Andrew Watt> set-location Registry::HKLM > PS Microsoft.PowerShell.Core\Registry::HKLM> set-location > FileSystem::C > Set-Location : Cannot find path 'C' because it does not exist. > At line:1 char:13 > + set-location <<<< FileSystem::C > PS Microsoft.PowerShell.Core\Registry::HKLM> set-location > FileSystem::C: > PS Microsoft.PowerShell.Core\FileSystem::C:\> set-location > Registry::HKLM: > Set-Location : Cannot find path 'HKLM:' because it does not exist. > At line:1 char:13 > + set-location <<<< Registry::HKLM: > PS Microsoft.PowerShell.Core\FileSystem::C:\> (get-childitem > function rompt).definition> 'PS ' + $(Get-Location) + $(if ($nestedpromptlevel -ge 1) { '>>' }) + > '> ' > PS Microsoft.PowerShell.Core\FileSystem::C:\> > > For information here also is my prompt() function. It's the default. > > PS Microsoft.PowerShell.Core\FileSystem::C:\> (get-childitem > function rompt).definition> 'PS ' + $(Get-Location) + $(if ($nestedpromptlevel -ge 1) { '>>' }) + > '> ' > PS Microsoft.PowerShell.Core\FileSystem::C:\> > > Can others confirm the behaviour? Do you see the differences as > desirable? > > Andrew Watt MVP |
My System Specs![]() |
| | #4 (permalink) |
| Guest | Re: Inconsistent behaviour when using set-location with different providers And to duplicate your confusion using the registry provider as an example: PS > new-psdrive HKEY_LOCAL_MACHINE Registry HKEY_LOCAL_MACHINE .... PS > cd HKEY_LOCAL_MACHINE: PS HKEY_LOCAL_MACHINE:\> PS > cd Registry::HKEY_LOCAL_MACHINE PS Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE> And bingo, it looks "inconsistent" again. - Oisin Oisin Grehan wrote: > The answer is quite simple -- "c:" and "filesystem::c:" are two > different paths. The first is the *name* of a PSDrive (e.g. "C") which > happens to look the same as a windows filesystem root drive , the > second is a provider direct path, which specifies the provider and the > root for said provider. The second is _equivalent_ to the first, but is > not the same powershell path. > > - Oisin > > > > Andrew Watt [MVP] wrote: > > Try the following commands. I would be interesed if you can confirm > > the same inconsistencies in behaviour that I show below. > > > > There are three issues that I see: > > > > 1. Why does providing the provider name (or not) in the command affect > > what is displayed in the prompt? > > > > 2. Why is the behaviour of the FileSystem provider and Registry > > provider different? Is the inconsistency a bug? > > > > 3. Why does set-location C: and set-location FileSystem::C: take you > > to different folders? Bug? > > > > PS C:\Documents and Settings\Andrew Watt> set-location HKLM: > > PS HKLM:\> set-location C: > > > > So far so good. But when you provide the name of the provider it > > appears in the prompt. > > > > PS C:\Documents and Settings\Andrew Watt> set-location Registry::HKLM > > > > If you omit the colon with the FileSystem provider you can an error. > > > > PS Microsoft.PowerShell.Core\Registry::HKLM> set-location > > FileSystem::C > > Set-Location : Cannot find path 'C' because it does not exist. > > At line:1 char:13 > > + set-location <<<< FileSystem::C > > > > But it works with the colon in place. > > > > PS Microsoft.PowerShell.Core\Registry::HKLM> set-location > > FileSystem::C: > > > > Providing the colon with the Registry provider produces an error (the > > FileSystem equivalent worked). > > > > PS Microsoft.PowerShell.Core\FileSystem::C:\> set-location > > Registry::HKLM: > > Set-Location : Cannot find path 'HKLM:' because it does not exist. > > At line:1 char:13 > > + set-location <<<< Registry::HKLM: > > > > For convenience here are the commands with no interpolated comment: > > > > PS C:\Documents and Settings\Andrew Watt> set-location HKLM: > > PS HKLM:\> set-location C: > > PS C:\Documents and Settings\Andrew Watt> set-location Registry::HKLM > > PS Microsoft.PowerShell.Core\Registry::HKLM> set-location > > FileSystem::C > > Set-Location : Cannot find path 'C' because it does not exist. > > At line:1 char:13 > > + set-location <<<< FileSystem::C > > PS Microsoft.PowerShell.Core\Registry::HKLM> set-location > > FileSystem::C: > > PS Microsoft.PowerShell.Core\FileSystem::C:\> set-location > > Registry::HKLM: > > Set-Location : Cannot find path 'HKLM:' because it does not exist. > > At line:1 char:13 > > + set-location <<<< Registry::HKLM: > > PS Microsoft.PowerShell.Core\FileSystem::C:\> (get-childitem > > function rompt).definition> > 'PS ' + $(Get-Location) + $(if ($nestedpromptlevel -ge 1) { '>>' }) + > > '> ' > > PS Microsoft.PowerShell.Core\FileSystem::C:\> > > > > For information here also is my prompt() function. It's the default. > > > > PS Microsoft.PowerShell.Core\FileSystem::C:\> (get-childitem > > function rompt).definition> > 'PS ' + $(Get-Location) + $(if ($nestedpromptlevel -ge 1) { '>>' }) + > > '> ' > > PS Microsoft.PowerShell.Core\FileSystem::C:\> > > > > Can others confirm the behaviour? Do you see the differences as > > desirable? > > > > Andrew Watt MVP |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Inconsistent window behaviour | Live Mail | |||
| WLM 9 Beta: Inconsistent Behaviour in number of contacts in catego | Live Messenger | |||
| Access 2003 database inconsistent behaviour between Vista and XP | Vista General | |||
| Inconsistent Usenet quoting behaviour | Vista mail | |||
| Seemingly inconsistent behaviour | PowerShell | |||