forked from springcomp/powershell_profile.ps1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Microsoft.PowerShell_utils-profile.ps1
98 lines (92 loc) · 2.8 KB
/
Microsoft.PowerShell_utils-profile.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# 1.0.8014.21663
if ($null -eq (Test-Command "clipp")) {
Function clipp {
[CmdletBinding()]
param(
[Parameter(ValueFromPipeline = $true)]
[string]$text = $null,
[Parameter(Mandatory = $false, Position = 0)]
[Alias("PSPath")]
[Alias("FullName")]
[string]$path = $null
)
PROCESS {
if ((-not $text) -and (-not $path)) { . "CLIP.EXE" }
else {
if ([bool] $path) { Get-Content -Path $path | . "CLIP.EXE" }
if ([bool] $text) { $text | . "CLIP.EXE" }
}
}
}
}
Function c {
[CmdletBinding()]
param(
[Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
[Alias("PSPath")]
[Alias("FullName")]
[string] $path = "."
)
. code $path
}
Function ccv { Get-CurrentVersion | clipp }
Function cguid { [Guid]::NewGuid().guid | clipp }
Function cwd { $PWD.Path | clipp }
Function csp {
[CmdletBinding()]
param(
[Parameter(Position = 0)]
[string]$path = $profile
)
code (split-path -path "$path")
}
Function esp { explorer (split-path $args) }
Function ewd {
param([string] $path = $PWD.Path)
if ($path.EndsWith("\")) {
$path = $path.Substring(0, $path.Length - 1)
}
explorer $path
}
Set-Alias -Name e -Value ewd
Function filezilla { & 'C:\Portable Apps\FileZilla\FileZillaPortable.exe' }
Set-Alias -Name zilla -Value filezilla
Function Get-CurrentVersion {
$epoch = [DateTime]::Parse("2000-01-01")
$now = Get-Date
$build = [Math]::Floor(($now - $epoch).TotalDays)
$rev = [Math]::Floor(($now - $now.Date).TotalSeconds / 2)
Write-Output "1.0.$($build).$($rev)"
}
Set-Alias -Name gcv -Value Get-CurrentVersion
Function izarc { & 'C:\Portable Apps\IZarc2Go\IZArc2Go.exe' }
Function keepass { & 'C:\Portable Apps\KeePass\KeePass.exe' }
Set-Alias -Name kp -Value keepass
Function mkcdir {
param([string]$path)
if (-not $path) { return }
New-Item -Path $path -ItemType Directory -EA SilentlyContinue | Out-Null
if (Test-Path -Path $path) { Set-Location -Path $path }
}
Function rmf {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
[Alias("PSPath")]
[Alias("FullName")]
[string]$path
)
PROCESS {
Remove-Item `
-Path $path `
-Recurse `
-Force `
-EA SilentlyContinue
}
}
Function servicebus {
Push-Location -Path $Env:TEMP\
& 'C:\Portable Apps\ServiceBus Explorer\ServiceBusExplorer.exe'
Pop-Location
}
Set-Alias -Name sbex -Value servicebus