Skip to content

Instantly share code, notes, and snippets.

@Jaykul
Last active November 24, 2015 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jaykul/23c3e2e0d2af46f08b64 to your computer and use it in GitHub Desktop.
Save Jaykul/23c3e2e0d2af46f08b64 to your computer and use it in GitHub Desktop.
PowerShell 5 Classes (v 10586)
PS> mkdir ClassContainer
Directory: C:\Users\Joel\Documents\WindowsPowerShell\TestData\modules
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 11/23/2015 7:41 PM ClassContainer
PS> cd .\ClassContainer\
PS> 'class FooMatic { [string]$Name = "Joel" }' > ClassContainer.psm1
PS> cd ..
PS> $Env:PSModulePath += ";$pwd"
PS> 'using module classcontainer
· [FooMatic]::New() ' > test.ps1
PS> .\test.ps1
Name
----
Joel
PS> using module classcontainer
PS> [FooMatic]::New()
Name
----
Joel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment