PSUtils
June 15, 2017 · View on GitHub
My PowerShell utils
Place it in %MyDocuments%\WindowsPowerShell\Modules and Import-Module PSUtils
-
app— run application (in case of ambiguity between app and cmdlet) -
json,unjson— encode/decode JSON to/from PSObject -
clear-clibboard,set-clipboard,out-clipboard,get-clipboardwith aliasesclear-clip,set-clip,out-clip,get-clip— clipboard utils,out-clipappends data to clipboard when called inforeach -
get-handle— get handles with SysInternals handle util, returnsPSObjects -
select-match— select-string with two enhancements: allows selecting only matched value (or group), and also can color output -
colorize— colorize regex-matched parts of string -
tags— get tags of audio file with TagLib library -
whereis— locate executable withwhereutil -
invoke-cmd— invoke .bat file and update environment variables changes -
screenshot,printscreen— take screenshot withDrawing.Graphicsor simulatingPrtScrbutton -
save-image— save image to file, use it with function above:screenshot | save-image pics -
timer— run script with interval -
hash— createhashtablefrom input,ls | hash Name FullName -
template— replace variables in text/files, on string input replaces variables'$x = $y...' | template @{x=10;y=(1,2,3)}⇒10 = 1,10 = 2,10 = 3, on file/path input — replace variables both in file/path names and in its contents and copies substituted files to destination directory -
enumerate— convert container to sequence of elements -
numerate— numerate files, for examplels *.png | sort -Property CreationTime | numerate -Digits 2will rename to01.png,02.png, ... in order ofCreationTime.numerate -Digits 2 -Format 'foo {0}'to specify template for new name, result will befoo 01.pngetc. -
watch-path— watch for file creation/changing/deletion in path -
beep— shortcut for[console]::Beep -
xpath— query elements from HTML -
download— download page -
wreq— invoke web request, returning string result -
time— measure script block running time -
unzip,zip,lszip— very simple zip utils in top of 7z -
codepage— get/set codepage or run block with specified codepage -
encoding— get/set encoding or run block with specified encoding, it's useful to run some cmd tool with $OutputEncoding set -
verbose— set $VerbosePreference toContinuewithin script -
verbs— get verbs for file -
path— justGetFolderPath -
import-profile— reload profile scripts -
rhistory— search in history -
environment— get env as hashtable, or set env from hashtable -
dictionary(aliasdict) andgdict— working with simple dictionary in top of JSON -
wait— wait for process -
test-ctrlc— throw exception if Ctrl+C pressed -
record— record screenshots of process -
animate— make gif-animation for images, uses ImageMagickconvert -
expand— expand string with variables -
closure— simple closure, convert script to string, then expand and convert back to script -
fuzzymatch— fuzzy match like sublimetext one