-
Notifications
You must be signed in to change notification settings - Fork 0
/
Microsoft.PowerShell_profile.ps1
89 lines (82 loc) · 3 KB
/
Microsoft.PowerShell_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
#place in \users\username\documants\windowspowershell
function display-path {Get-ChildItem Env:Path }
function folder {
[CmdletBinding(DefaultParameterSetName='Default')]
param(
[Alias('u')]
[switch] $Username
,
<#
example for your own folder. see line 46
[Alias('s')]
[Parameter(ParameterSetName='Scripts')]
[switch] $Scripts
, #>
[Parameter(ParameterSetName='Desktop')]
[Alias('d')]
[switch] $Desktop
,
[Alias('h')]
[Parameter(ParameterSetName = 'help')]
[switch]$Help
,
[Alias('r')]
[Parameter(ParameterSetName = 'root')]
[switch]$root
)
<#
**One of these can be used to navigate to the username directory. The first will only allow you to navigate to one user, the second allows for you to select the user.**
$targetFolder =
if ($Username) {
$targetFolder += env:USERPROFILE #replace with your username
}
if ($Username) {
Join-Path (Split-Path -LiteralPath $HOME) $Username
} else {
$HOME
} #>
$targetFolder = $env:USERPROFILE
if ($Username) {
$targetFolder = $env:USERPROFILE
$u = ' -U'
}
<# example continued.
elseif ($Scripts) {
$targetFolder += '\Desktop\Scripts'
}#>
elseif ($Desktop) {
$targetFolder += '\Desktop'
}
elseif ($root) {
## same as other but we can use $env:homedrive for the root of C:
$targetFolder = $env:HOMEDRIVE + '\'
$r = ' -R '
}
elseif ($Help) {
echo "
-H Display help. This is the same as not typing any options.
-U Change to the 'Username' directory
-S Change to the 'scripts' directory
-D Change to the 'desktop' directory"
}
else {
echo "
-H Display help. This is the same as not typing any options.
-U Change to the 'Username' directory
-S Change to the 'scripts' directory
-D Change to the 'desktop' directory"
}
Push-Location -LiteralPath $targetFolder
}
set-alias -Name path -Value display-path
Set-Alias -Name ip -Value ipconfig -Option AllScope
Set-Alias cat -Value type -Option AllScope
Set-Alias cp -Value copy -Option AllScope
Set-Alias cpr -Value xcopy -Option AllScope
Set-Alias grep -Value find -Option AllScope
Set-Alias man -Value help -Option AllScope
Set-Alias mv -Value move -Option AllScope
Set-Alias ps -Value tasklist -Option AllScope
Set-Alias rm -Value del -Option AllScope
Set-Alias rmr -Value deltree -Option AllScope
Set-Alias get -Value Get-Item