![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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) |
| | How can I escape a slash character in item name? I have a problem with my powershell. When I execute a command like this: gi "HKLM:\SOFTWARE\Classes\AutoProxyTypes\Application/x-internet-signup" an error occurr like this: Get-Item : Cannot find path 'HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoProxyTypes\Application\x-internet-signup' because it does not exist. At line:1 char:3 + gi <<<< "HKLM:\SOFTWARE\Classes\AutoProxyTypes\Application/x-internet-signup" How can I solve this problem in my powershell? |
My System Specs![]() |
| | #2 (permalink) |
| | Re: How can I escape a slash character in item name? Backtick "`" is the escape character, but for what your doing I don't see the need. Maybe its a language pack issue, but gi "HKLM:SOFTWARE\Classes\AutoProxyTypes\Application\x-internet-signup" should just work. -- Brandon Shell --------------- Stop by my blog some time Blog: http://www.bsonposh.com/ PSH Scripts Project: www.codeplex.com/psobject -------------------------------------- "KH.Lee" <redjade.lee@gmail.com> wrote in message news:Ojq5ZXhZHHA.4368@TK2MSFTNGP06.phx.gbl... >I have a problem with my powershell. > When I execute a command like this: > > gi "HKLM:\SOFTWARE\Classes\AutoProxyTypes\Application/x-internet-signup" > > an error occurr like this: > > Get-Item : Cannot find path > > 'HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoProxyTypes\Application\x-internet-signup' > because > it does not exist. > At line:1 char:3 > + gi <<<< > "HKLM:\SOFTWARE\Classes\AutoProxyTypes\Application/x-internet-signup" > > How can I solve this problem in my powershell? |
My System Specs![]() |
| | #3 (permalink) |
| | Re: How can I escape a slash character in item name? Thank for your answer ^^ Sorry, but I already know that the Backtick "`" is the escape character. In the filesystem, there is no way to use the slash "/" character in the name of the file and directory. But, in the registry, it is possible to use the slash "/" character in the key name. For example, "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\MIME\Database\Content Type" key contains following subkeys. -------------------------------------------------------------------- cmd /c reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\MIME\Database\Content Type" -------------------------------------------------------------------- application/atom+xml application/fractals application/futuresplash application/haansofthwp application/hta .... -------------------------------------------------------------------- and they contains a "/" character in their's name. Simply... gci -r "HKLM:\SOFTWARE\Classes\mime\Database\Codepage" This is works fine ... But, gci -r "HKLM:\SOFTWARE\Classes\mime\Database\Content Type" this is not works, How can I list all the subkeys? Thanks. Brandon Shell ¾´ ±Û: > Backtick "`" is the escape character, but for what your doing I don't > see the need. > > Maybe its a language pack issue, but > gi "HKLM:SOFTWARE\Classes\AutoProxyTypes\Application\x-internet-signup" > should just work. > > -- > Brandon Shell > --------------- > Stop by my blog some time ![]() > Blog: http://www.bsonposh.com/ > PSH Scripts Project: www.codeplex.com/psobject > <http://www.codeplex.com/psobject> > -------------------------------------- > "KH.Lee" <redjade.lee@gmail.com <mailto:redjade.lee@gmail.com>> wrote in > message news:Ojq5ZXhZHHA.4368@TK2MSFTNGP06.phx.gbl... > >I have a problem with my powershell. > > When I execute a command like this: > > > > gi "HKLM:\SOFTWARE\Classes\AutoProxyTypes\Application/x-internet-signup" > > > > an error occurr like this: > > > > Get-Item : Cannot find path > > > > > 'HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoProxyTypes\Application\x-internet-signup' > > because > > it does not exist. > > At line:1 char:3 > > + gi <<<< > > "HKLM:\SOFTWARE\Classes\AutoProxyTypes\Application/x-internet-signup" > > > > How can I solve this problem in my powershell? |
My System Specs![]() |
| | #4 (permalink) |
| | Re: How can I escape a slash character in item name? I see what you mean. I think that is a bug in Get-ChildItem. This will work (did for me) $key = gi HKLM:\SOFTWARE\Classes\mime\Database\Content Type $key.GetSubKeyNames() You can also do $key.OpenSubKey("$subkeyName") like $key.OpenSubKey("video/x-mpeg") if you want all the subkeys you can do $key = gi HKLM:\SOFTWARE\Classes\mime\Database\Content Type foreach($sub in $key.GetSubKeyNames()) { $key.OpenSubKey($sub) } -- "KH.Lee" <redjade.lee@gmail.com> wrote in message news:OQtKLvlZHHA.1388@TK2MSFTNGP05.phx.gbl... > Thank for your answer ^^ > > Sorry, but I already know that the Backtick "`" is the escape character. > > In the filesystem, there is no way to use the slash "/" character in the > name of the file and directory. > > But, in the registry, it is possible to use the slash "/" character in > the key name. For example, > "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\MIME\Database\Content Type" key > contains following subkeys. > > -------------------------------------------------------------------- > cmd /c reg query > "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\MIME\Database\Content Type" > -------------------------------------------------------------------- > application/atom+xml > application/fractals > application/futuresplash > application/haansofthwp > application/hta > ... > -------------------------------------------------------------------- > and they contains a "/" character in their's name. > > Simply... > > gci -r "HKLM:\SOFTWARE\Classes\mime\Database\Codepage" > > This is works fine ... But, > > gci -r "HKLM:\SOFTWARE\Classes\mime\Database\Content Type" > > this is not works, > > How can I list all the subkeys? > > Thanks. > > > Brandon Shell ¾´ ±Û: >> Backtick "`" is the escape character, but for what your doing I don't >> see the need. >> >> Maybe its a language pack issue, but >> gi "HKLM:SOFTWARE\Classes\AutoProxyTypes\Application\x-internet-signup" >> should just work. >> >> -- >> Brandon Shell >> --------------- >> Stop by my blog some time ![]() >> Blog: http://www.bsonposh.com/ >> PSH Scripts Project: www.codeplex.com/psobject >> <http://www.codeplex.com/psobject> >> -------------------------------------- >> "KH.Lee" <redjade.lee@gmail.com <mailto:redjade.lee@gmail.com>> wrote in >> message news:Ojq5ZXhZHHA.4368@TK2MSFTNGP06.phx.gbl... >> >I have a problem with my powershell. >> > When I execute a command like this: >> > >> > gi >> "HKLM:\SOFTWARE\Classes\AutoProxyTypes\Application/x-internet-signup" >> > >> > an error occurr like this: >> > >> > Get-Item : Cannot find path >> > >> > >> 'HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoProxyTypes\Application\x-internet-signup' >> > because >> > it does not exist. >> > At line:1 char:3 >> > + gi <<<< >> > "HKLM:\SOFTWARE\Classes\AutoProxyTypes\Application/x-internet-signup" >> > >> > How can I solve this problem in my powershell? |
My System Specs![]() |
| | #5 (permalink) |
| | Re: How can I escape a slash character in item name? Brandon Shell ¾´ ±Û: > I see what you mean. I think that is a bug in Get-ChildItem. > > This will work (did for me) > $key = gi HKLM:\SOFTWARE\Classes\mime\Database\Content Type > $key.GetSubKeyNames() > > You can also do > $key.OpenSubKey("$subkeyName") > like > $key.OpenSubKey("video/x-mpeg") > > if you want all the subkeys you can do > $key = gi HKLM:\SOFTWARE\Classes\mime\Database\Content Type > foreach($sub in $key.GetSubKeyNames()) > { > $key.OpenSubKey($sub) > } Thanks. |
My System Specs![]() |
| | #6 (permalink) |
| | Re: How can I escape a slash character in item name? I also think thats a bug - you cannot use set-location within the registry if the path contains an "illegal" character - a good (or better bad) example is the registry entry of the n software cmdlets which is /n software NetCmdlet (to make it appear first in line). A cd "hklm:/Software\Microsoft\Windows\CurrentVersion\App Management\arpcache\/n software NetCmdlet" won't do it because of the / in the beginning. Regads, Peter PS: Or may be its something only Bruce knows an answer for ![]() "KH.Lee" <redjade.lee@gmail.com> schrieb im Newsbeitrag news:uhsPAAvZHHA.208@TK2MSFTNGP05.phx.gbl... > Brandon Shell ¾´ ±Û: >> I see what you mean. I think that is a bug in Get-ChildItem. >> >> This will work (did for me) >> $key = gi HKLM:\SOFTWARE\Classes\mime\Database\Content Type >> $key.GetSubKeyNames() >> >> You can also do >> $key.OpenSubKey("$subkeyName") >> like >> $key.OpenSubKey("video/x-mpeg") >> >> if you want all the subkeys you can do >> $key = gi HKLM:\SOFTWARE\Classes\mime\Database\Content Type >> foreach($sub in $key.GetSubKeyNames()) >> { >> $key.OpenSubKey($sub) >> } > > Thanks. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Re: exchange shell escape character | PowerShell | |||
| Escape character question | PowerShell | |||
| How do I escape the wildcard character in a path string? | PowerShell | |||
| howto? escape the comment character | PowerShell | |||
| Bug in escape character / variable expansion? | PowerShell | |||