-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProfile.ps1
More file actions
39 lines (34 loc) · 1.74 KB
/
Profile.ps1
File metadata and controls
39 lines (34 loc) · 1.74 KB
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
### PowerShell template profile
### Version 1.00
###
### Current User, All Hosts - Windows - $HOME\Documents\PowerShell\Profile.ps1
### This file should be stored in $PROFILE.CurrentUserAllHosts
### For Mac/Linux just do vim $PROFILE.CurrentUserAllHosts to edit the file
#### To relaod the profile just do . $PROFILE.CurrentUserAllHosts
### If $PROFILE.CurrentUserAllHosts doesn't exist, you can make one with the following:
### New-Item -ItemType File -Path $PROFILE.CurrentUserAllHosts -Force
### This will create the file and the containing subdirectory if it doesn't already
###
### As a reminder, to enable unsigned script execution of local scripts on client Windows,
### you need to run this line (or similar) from an elevated PowerShell prompt:
### Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
### This is the default policy on Windows Server 2012 R2 and above for server Windows. For
### more information about execution policies, run Get-Help about_Execution_Policies.
# Useful shortcuts for traversing directories
# Thanks to https://gist.github.com/timsneath/19867b12eee7fd5af2ba
function cd... { cd ..\.. }
function cd.... { cd ..\..\.. }
# Get md5,sha256 and file name , input support multiple string with wildcard
function hashes {
Get-ChildItem -Path $args -Force -Recurse -File |
Select-Object @{Name='MD5';E={(Get-FileHash -Algorithm MD5 $_).Hash}},
@{N='SHA256';E={(Get-FileHash -Algorithm SHA256 $_).Hash}},Name
}
function md5 {
Get-ChildItem -Path $args -Force -Recurse -File |
Select-Object @{Name='MD5';E={(Get-FileHash -Algorithm MD5 $_).Hash}}, Name
}
function sha256 {
Get-ChildItem -Path $args -Force -Recurse -File |
Select-Object @{Name='SHA256';E={(Get-FileHash -Algorithm SHA256 $_).Hash}}, Name
}