Skip to content

Instantly share code, notes, and snippets.

function logicalpath($path) {
// same as realpath() except keeps logical paths
if (!file_exists($path)) {
return False;
}
$filename = '';
if (is_file($path)) {
$filename = (basename($path));
$length = strlen($filename);
$path = substr($path, 0, -$length);
@markclowes
markclowes / tping.ps1
Created April 12, 2019 20:14
Powershell ping that displays response time in Windows taskbar
param (
[string]$ip = "8.8.8.8"
)
do {
$ping = Test-Connection $ip -Count 1 -ErrorAction SilentlyContinue
if ($ping -eq $null) {
$host.UI.RawUI.WindowTitle = "Ping: timeout"
write-host "Ping $ip : timeout"
} else {