Skip to content

list static members of a dotnet class in powershell

2011/06/03

looking what the dotnet class “environment” can be used for, i tried to list the static member functions which can be called with

[environment]::functionname()

The first guess was to use

[environment] | gm

It which gave me a huge list of methods and properties but not the static ones

[environment] | gm -static does the job:

 

C:\> [environment] | get-member -Static


   TypeName: System.Environment

Name                       MemberType Definition
----                       ---------- ----------
Equals                     Method     static bool Equals(System.Object objA, Syst
Exit                       Method     static System.Void Exit(int exitCode)
ExpandEnvironmentVariables Method     static string ExpandEnvironmentVariables(st
FailFast                   Method     static System.Void FailFast(string message)
GetCommandLineArgs         Method     static string[] GetCommandLineArgs()
GetEnvironmentVariable     Method     static string GetEnvironmentVariable(string
GetEnvironmentVariables    Method     static System.Collections.IDictionary GetEn
GetFolderPath              Method     static string GetFolderPath(System.Environm
GetLogicalDrives           Method     static string[] GetLogicalDrives()
ReferenceEquals            Method     static bool ReferenceEquals(System.Object o
SetEnvironmentVariable     Method     static System.Void SetEnvironmentVariable(s
CommandLine                Property   static System.String CommandLine {get;}
CurrentDirectory           Property   static System.String CurrentDirectory {get;
ExitCode                   Property   static System.Int32 ExitCode {get;set;}
HasShutdownStarted         Property   static System.Boolean HasShutdownStarted {g
MachineName                Property   static System.String MachineName {get;}
NewLine                    Property   static System.String NewLine {get;}
OSVersion                  Property   static System.OperatingSystem OSVersion {ge
ProcessorCount             Property   static System.Int32 ProcessorCount {get;}
StackTrace                 Property   static System.String StackTrace {get;}
SystemDirectory            Property   static System.String SystemDirectory {get;}
TickCount                  Property   static System.Int32 TickCount {get;}
UserDomainName             Property   static System.String UserDomainName {get;}
UserInteractive            Property   static System.Boolean UserInteractive {get;
UserName                   Property   static System.String UserName {get;}
Version                    Property   static System.Version Version {get;}
WorkingSet                 Property   static System.Int64 WorkingSet {get;}

 

 

Advertisements

From → basics, powershell

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: