Report Shortcut Properties
When working with a folder that contains several shortcuts, it can be tedious to check the properties of each shortcut. This PowerShell script loops over all of the shortcuts in the folder and reports the name of the executable, start in path, and command line arguments in table format.
$path = Read-Host "Enter the path to search for shortcuts"; Get-ChildItem $path -Filter *.lnk | Select-Object @{Name='Shortcut';Expression={$.Name}}, @{Name='Target';Expression={(New-Object -ComObject WScript.Shell).CreateShortcut($.FullName).TargetPath}}, @{Name='Arguments';Expression={(New-Object -ComObject WScript.Shell).CreateShortcut($.FullName).Arguments}}, @{Name='StartIn';Expression={(New-Object -ComObject WScript.Shell).CreateShortcut($.FullName).WorkingDirectory}} | Format-Table -AutoSize
PowerShell Tail From Temp File Containing Date
$currentDate = Get-Date -Format "yyyy-MM-ss";
# The file is in the parent temp directory, not the user specific temp directory
$TailFilePath = $env:TEMP + "\..\$currentDate process log usage.txt";
Get-Content -Path $TailFilePath -Wait -Tail 15;
Set the PowerShell Window Title
$host.ui.RawUI.WindowTitle = "My Useful Script is Running " + $MyInvocation.MyCommand.Path;
Source:
https://www.tutorialspoint.com/how-to-get-the-path-of-the-currently-executing-script-in-powershell
Shell Command to List Path To Files
If you need a list of full paths to the files in the current directory use the readlink command:
readlink -r *
Shell Command To Recursively Find Most Recently Modified Files
find . -type f -exec stat --format '%Y :%y %n' "{}" \; | sort -nr | cut -d: -f2- | head
Adapted from https://stackoverflow.com/questions/5566310/how-to-recursively-find-and-list-the-latest-modified-files-in-a-directory-with-s