Windows Power Shell

From s23
Jump to navigation Jump to search

Windows Power Shell is the coming replacement for the (good?) old cmd.exe. It works object-oriented and supports pipes


get-alias (show (predefined) aliases)
get-command (show all available "commandlets")
get-help commandletname (get help about a commandlet)

get-help get (list all commandlets that contain the verb "get")
get-psdrive (show drives, environment variables, registry and aliases)

commandline registry[edit]

WPS makes no difference between regular files ,the registry or aliase as in:

cd hklm:\software (change "directory" to the registry HKEY_LOCAL_MACHINE/Software)
dir (list the subkeys)
md fnord (create new subkey fnord)
new-item .name "Foo" - value "Bar" - type string (put the value Bar into the key)

3 ways to kill all IE processes using (object oriented) pipelines[edit]

get-process | where object { $ -eq "iexplore" } | foreach-object { $_.kill() }


ps | ? { $ -eq "iexplore" } | % { $_.kill() }

even shorter:

ps -p "iexplore"  | % {$_.kill() }


Download Windows Power Shell RC 1

Windows Power Shell Docs

(Downloads need Microsoft-Passport ;P)

Weiterführend: iX-Magazin August 2006 S. 139)