powershell Powershell简介

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell Powershell简介相关的知识,希望对你有一定的参考价值。

Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)

# Load posh-git module from current default module locaiton
Import-Module posh-git

#Load PSReadline 
Import-Module PSReadLine  

# Set up a simple prompt, adding the git prompt parts inside git repos
function global:prompt {
    $realLASTEXITCODE = $LASTEXITCODE

    # Reset color, which can be messed up by Enable-GitColors
    $Host.UI.RawUI.ForegroundColor = $GitPromptSettings.DefaultForegroundColor

    Write-Host($pwd.ProviderPath) -nonewline

    Write-VcsStatus

    $global:LASTEXITCODE = $realLASTEXITCODE
    return "> "
}

function gh{
	
	$url = & git config --get remote.origin.url
    $url = $url.TrimEnd(".git")
    $branch = & git symbolic-ref HEAD 
    Write-Host "On Branch" $branch
    $branch = $branch.Substring(11,($branch.length-11))
    Write-Host $branch
    $url = $url.ToString() + "/tree/" + $branch.ToString()
	
    Write-Host "Opening" $url
    
    [System.Diagnostics.Process]::Start($url)
    return
}

function gh-pull{
	
	$url = & git config --get remote.origin.url
    $url = $url.TrimEnd(".git")
    $url = $url.ToString() + "/pulls"
	
    Write-Host "Opening" $url
    
    [System.Diagnostics.Process]::Start($url)
    return
}


#aliase hub
new-alias git hub.exe

Pop-Location

# Load posh-git example profile
. 'C:\Users\richa_000\Documents\WindowsPowerShell\Modules\posh-git\profile.example.ps1'

Set-PSReadlineKeyHandler -Key Tab -Function Complete

 

以上是关于powershell Powershell简介的主要内容,如果未能解决你的问题,请参考以下文章

MSSQL/WMI/PowerShell结合篇简介

PowerShell第一讲,别名,变量,命令。

powershell 基础

powershell Powersehll简介

Powershell简介及其编程访问

PowerShell 快速入门