Sunday, July 16, 2006

(PS) how to get back "home"

I have a story of being a keyboard guy and a "command line guy", recently I have been interested in PowerShell; thanks to the secret geek I was encouraged to download it and try a few things, so far I'm loving it!, it's awesome... of course this is definitely not for everyone, specially not for programmers =o(, at least the great mayority of the ones I know don't really like command line stuff, anyway (is not like you are required to be an expert on it, PowerShell is oriented at System Administrators, I just happen to prefer command line when working at a computer, is just so much faster to accomplish things).

I was reading on the secret geek blog about one of the cmd-lets:"Get-PSDrive":

Once Upon A PowerShell i went looking for a cmdLet to display a list of all the current drives.I found one, 'Get-PSDrive' which does exactly that... but i was gobsmacked at what else it revealed!'Power shell drives' are not just your boring old 'C:' etc -- they can be all sorts of hierarchical structures, such a registry keys, environment variables, functions(!) and more.

Babysteps in PowerShell part deux: Variables! Real Proper Variables!

on mi machine it displays something like:

PS C:\> get-psdrive

Name       Provider      Root
----       --------      ----
A          FileSystem    A:\
Alias      Alias
C          FileSystem    C:\
cert       Certificate   \
D          FileSystem    D:\
E          FileSystem    E:\
Env        Environment
F          FileSystem    F:\
Function   Function
HKCU       Registry      HKEY_CURRENT_USER
HKLM       Registry      HKEY_LOCAL_MACHINE
Variable   Variable


PS C:\>

notice those Function, HKCU, HKLM and Variable at the end...

you can do a "cd Variable:" then do a "ls" or "dir" and it will list the variables declared, you can do "cd Alias:", then "dir" will list the aliases in the system (alias for the different cmd-lets")


anyway, I was playing with those and for a few seconds I was stuck when I did "cd Alias:", after finding out what was there, I wanted to go back, so I immediatly did "cd ..", didn't work, "cd \", nop... "cd /" nothing... panic!

quite simple actually, we just need "c:" or "cd c:"

(uff, that was close)... and now I have a new category to blog about

technorati tags:,

2 comments:

Anonymous said...

> of course this is definitely not for everyone, specially not for programmers

For what it is worth - Windows PowerShell is written in C#. As we develop new features, many guys on the team are finding themselves prototyping the feature in PowerShell because it is so fast and fun. Later it gets recast as C# and checked in. As programmers we LOVE Windows PowerShell. We are biased of course but kick the tires for a few weeks and then reevaluate.

Jeffrey Snover [MSFT]
Windows PowerShell/Aspen Architect
Visit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShell
Visit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx

BlackTigerX said...

I'm all for PowerShell, is just that in my experience with programmers and command line stuff, they just look at me like I'm weird because I do so much (and so fast, or so they say) on the command line... ok, maybe I am bit weird =o|

but hopefully PowerShell will change things, because it definitely has a ton of stuff that programmers could use

p.s. WOW!... Jeffrey Snover visiting my blog?