Freigeben über


My PowerShell host prompt

Looking at others code is the best way to learn. I looked at some and modified it, adding the environment variables for the Windows SDK 6.0 (for my needs). Here it is:

$env:MSSdk = "C:\Program Files\Microsoft SDKs\Windows\v6.0"

$env:SdkTools = "$env:MSSdk\Bin"

$env:OSLibraries = "$env:MSSdk\Lib"

$env:OSIncludes = "$env:MSSdk\Include;$env:MSSdk\Include\gl"

$env:VCTools = "$env:MSSdk\VC\Bin"

$env:VCLibraries = "$env:MSSdk\VC\Lib"

$env:VCIncludes = "$env:MSSdk\VC\Include;$env:MSSdk\VC\Include\Sys"

$env:ReferenceAssemblies = "$env:ProgramFiles\Reference Assemblies\Microsoft\WinFX\v3.0"

$env:Lib = "$env:VCLibraries;$env:OSLibraries;$env:Lib"

$env:Include = "$env:VCIncludes;$env:OSIncludes;$env:Include"

$env:CPU = "i386"

$env:APPVER = "6.0"

$env:TARGETOS = "WINNT"

$env:FxTools= "$env:windir\Microsoft.NET\Framework\v2.0.50727"

$env:Path = "$env:VCTools;$env:SdkTools;$env:FxTools;$env:Path"

$env:ReferenceAssemblies = "$env:ProgramFiles\Reference Assemblies\Microsoft\WinFX\v3.0"

Function prompt {

$host.ui.rawui.windowtitle = "PowerShell - `"" + $(get-location) + "`""

" [$(get-location)]`n> "

}

Thanks Jim!