![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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) |
| | Should New-Item consistently create needed path elements? New-Item is inconsistent in whether it will create necessary parent containers if some containers in a path do not exist. For example, suppose there is no FSO folder on drive C. Trying to create a file within C:\FSO fails, but trying to create a directory within C:\FSO succeeds - the parent and the child folders are both created. With the registry provider, path elements must be created one by one; even if there was a reason for the filesystem behavior, I would expect registry key creation (which is directly analogous to filesystem directory creation) would work. Bug this, or is there a reason for the different behavior across providers and itemtypes? |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Should New-Item consistently create needed path elements? > With the registry provider, path elements must be created one by one Just to say that you can do that in one line with "-force" parameter. I note now that "-force" switch seems to work for HKLM only if the first path element already exists (here SOFTWARE): new-item "hklm:\SOFTWARE\testreg\test1\test2\" -force and always works for HKCU : new-item "hkcu:\TEST\testreg\test1\test2\" -force The need sounds like the "-recurse" parameter of "remove-item" for me. Regards, -- Jean - JMST Belgium |
My System Specs![]() |
| | #3 (permalink) |
| | RE: Should New-Item consistently create needed path elements? I'd say bug it! (still hating inconsistency...) -- greetings dreeschkind "Alex K. Angelopoulos [MVP]" wrote: > New-Item is inconsistent in whether it will create necessary parent > containers if some containers in a path do not exist. > > For example, suppose there is no FSO folder on drive C. Trying to create a > file within C:\FSO fails, but trying to create a directory within C:\FSO > succeeds - the parent and the child folders are both created. > > With the registry provider, path elements must be created one by one; even > if there was a reason for the filesystem behavior, I would expect registry > key creation (which is directly analogous to filesystem directory creation) > would work. > > Bug this, or is there a reason for the different behavior across providers > and itemtypes? > > > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Should New-Item consistently create needed path elements? Bugged here. I added a comment about possibly controlling this with a -Recurse parameter. ![]() https://connect.microsoft.com/feedba...5314&SiteID=99 "dreeschkind" <dreeschkind@discussions.microsoft.com> wrote in message news:C1FB5829-B6DD-497C-A0F3-D825A7C339AC@microsoft.com... > I'd say bug it! > (still hating inconsistency...) > > -- > greetings > dreeschkind > > "Alex K. Angelopoulos [MVP]" wrote: > >> New-Item is inconsistent in whether it will create necessary parent >> containers if some containers in a path do not exist. >> >> For example, suppose there is no FSO folder on drive C. Trying to create >> a >> file within C:\FSO fails, but trying to create a directory within C:\FSO >> succeeds - the parent and the child folders are both created. >> >> With the registry provider, path elements must be created one by one; >> even >> if there was a reason for the filesystem behavior, I would expect >> registry >> key creation (which is directly analogous to filesystem directory >> creation) >> would work. >> >> Bug this, or is there a reason for the different behavior across >> providers >> and itemtypes? >> >> >> |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Create Directory on a UNC Path | PowerShell | |||
| path to item returned from get-childitem | PowerShell | |||
| It it possible create an Game Explorer item myself? | Vista Games | |||
| Vista Explorer Create New Item Not Visible on Create - Bug or Feature??? | Vista General | |||