![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | tab and variable I'm trying to use tab together with variable, e.g.: by typing $pshome<enter>, i have c:\windows\system32\windowspowershell\v1.0 i would expect $pshome\..\<tab> would resolve to c:\windows\system32\windowspowershell\v1.0\..\ OR c:\windows\system32\windowspowershell\v1.0\ but it does not, it resolves somewhere to c:\document and settings\username\$pshome\..\... am i using it right? Thanks! |
My System Specs![]() |
| | #2 (permalink) |
| Guest | RE: tab and variable <tab> works off the contents of your current location. Expecting it to pay attention to the current contents of PowerShell variables is probably a bit much. I think it's really impressive that you can do this, though:- cd hkcu: <enter> cd <tab>, <tab>, <tab>, <tab>, <tab>, and have it iterate through the contents of the HKCU drive. I would say that the PowerShell team have gone far enough integrating with the current Cmd.exe-style window, and in future releases it would be nice to see them using their own windowed environment. What they have done thus far (e.g. the example above) is damn impressive as it is. Andrew Webb |
My System Specs![]() |
| | #3 (permalink) |
| Guest | RE: tab and variable I think by saying '<tab> works off the contents of your current location' is correct, but the fact is the PS' tab-completion is worth more than that, I believe you can enter: hkcu:<tab> without being in hkcu drive. So PS is already pay attention to previous token, so by substition env. variable, I don't know, maybe you are right, 'a bit too much' "Andrew Webb" wrote: > <tab> works off the contents of your current location. Expecting it to pay > attention to the current contents of PowerShell variables is probably a bit > much. I think it's really impressive that you can do this, though:- > cd hkcu: <enter> > cd <tab>, <tab>, <tab>, <tab>, <tab>, > and have it iterate through the contents of the HKCU drive. > > I would say that the PowerShell team have gone far enough integrating with > the current Cmd.exe-style window, and in future releases it would be nice to > see them using their own windowed environment. What they have done thus far > (e.g. the example above) is damn impressive as it is. > > Andrew Webb |
My System Specs![]() |
| | #4 (permalink) |
| Guest | RE: tab and variable > I think by saying '<tab> works off the contents of your current location' is > correct, but the fact is the PS' tab-completion is worth more than that, I > believe you can enter: > hkcu:<tab> > without being in hkcu drive. You're right! Even more impressive than I thought. Try this: $e<tab><tab><tab> It will iterate through the current list of variables, listing those that begin with 'e'. This is what it will do with variables, rather than examine their contents - which I think answers your original question. |
My System Specs![]() |
| | #5 (permalink) |
| Guest | RE: tab and variable not really answer to my question, my question is why $pshome\..\ does not expand to c:\windows\system32\windowspowershell\ "Andrew Webb" wrote: > > I think by saying '<tab> works off the contents of your current location' is > > correct, but the fact is the PS' tab-completion is worth more than that, I > > believe you can enter: > > hkcu:<tab> > > without being in hkcu drive. > > You're right! Even more impressive than I thought. > > Try this: > $e<tab><tab><tab> > > It will iterate through the current list of variables, listing those that > begin with 'e'. This is what it will do with variables, rather than examine > their contents - which I think answers your original question. > > |
My System Specs![]() |
| | #6 (permalink) |
| Guest | Re: tab and variable hn wrote: > not really answer to my question, my question is why > $pshome\..\ > does not expand to > c:\windows\system32\windowspowershell\ It is because expanding the "value" of parameter is not implemented in the TabExpanion function( located in function:TabExpansion, and to see the definition of the function try, (ls function:TabExpansion).definition ). |
My System Specs![]() |
| | #7 (permalink) |
| Guest | Re: tab and variable hn wrote: > I'm trying to use tab together with variable, e.g.: > by typing $pshome<enter>, i have > c:\windows\system32\windowspowershell\v1.0 > > i would expect > $pshome\..\<tab> would resolve to > c:\windows\system32\windowspowershell\v1.0\..\ OR > c:\windows\system32\windowspowershell\v1.0\ > > but it does not, it resolves somewhere to > c:\document and settings\username\$pshome\..\... > > am i using it right? Thanks! Unfortunately PowerShell doesn't support this out of the box. I already filed a bug about it... But you can implement it yourself by modifying the definition of the TabExpansion function. Or, rather, you can use other people's tab expansion scripts. I know I've seen one posted to this newsgroup that does variable expansion and a number of other things... Perhaps somebody can reply with a link to the script, or perhaps you can post a new thread asking about the community's tab expansion addons. |
My System Specs![]() |
| | #8 (permalink) |
| Guest | Re: tab and variable Correct - the tab completion code for filenames isn't expanding variables in paths. It is possible to modify the TabCompletion function to do this with some work. Tab-completion in V1 is very much a glass-half full experience :-) -bruce -- Bruce Payette [MSFT] Windows PowerShell Technical Lead Microsoft Corporation This posting is provided "AS IS" with no warranties, and confers no rights. Visit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShell Visit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scr.../hubs/msh.mspx My book: http://manning.com/powershell "Sung M Kim" <DontBotherMeWithSpam@gmail.com> wrote in message news:1161104935.391170.273890@i42g2000cwa.googlegroups.com... > hn wrote: >> not really answer to my question, my question is why >> $pshome\..\ >> does not expand to >> c:\windows\system32\windowspowershell\ > > It is because expanding the "value" of parameter is not implemented in > the TabExpanion function( located in function:TabExpansion, and to see > the definition of the function try, (ls > function:TabExpansion).definition ). > |
My System Specs![]() |
| | #9 (permalink) |
| Guest | Re: tab and variable I have a series about TabExpansion on my blog : the latestversion is : http://mow001.blogspot.com/2006/10/p...on-part-5.html It realy adds a lot to the TabCompletion like (WMI,alias, history, functions etc. (even GUI form support for selecting from a list, and custom completion) and much more. This last version needs some preparement and getting used to, as it uses a DataBase to work, but after that is realy powerfull I think The former versions works as is, and might be more easy to start with : http://mow001.blogspot.com/2006/06/p...on-part-4.html on Codeplex : http://www.codeplex.com/Wiki/View.as...tName=PsObject Enjoy, Greetings /\/\o\/\/ "Adam Milazzo" <adamm@san.rr.com> wrote in message news:uGNVlri8GHA.4476@TK2MSFTNGP04.phx.gbl... > hn wrote: >> I'm trying to use tab together with variable, e.g.: >> by typing $pshome<enter>, i have >> c:\windows\system32\windowspowershell\v1.0 >> >> i would expect $pshome\..\<tab> would resolve to >> c:\windows\system32\windowspowershell\v1.0\..\ OR >> c:\windows\system32\windowspowershell\v1.0\ >> >> but it does not, it resolves somewhere to >> c:\document and settings\username\$pshome\..\... >> >> am i using it right? Thanks! > > Unfortunately PowerShell doesn't support this out of the box. I already > filed a bug about it... > > But you can implement it yourself by modifying the definition of the > TabExpansion function. Or, rather, you can use other people's tab > expansion scripts. I know I've seen one posted to this newsgroup that does > variable expansion and a number of other things... > > Perhaps somebody can reply with a link to the script, or perhaps you can > post a new thread asking about the community's tab expansion addons. |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| variable display? | Justin Rich | PowerShell | 3 | 11-28-2007 01:50 AM |
| Variable value question | Riggs | PowerShell | 3 | 04-13-2007 09:10 AM |
| RE: variable identification | Rob Campbell | PowerShell | 1 | 03-28-2007 04:02 AM |
| Set-Variable | Fred J. | PowerShell | 3 | 10-25-2006 12:39 PM |
| How can I ensure that a variable is a built-in powershell variable? | Sung M Kim | PowerShell | 7 | 09-22-2006 06:28 PM |