Skip to content

Instantly share code, notes, and snippets.

@markclowes
markclowes / tping.ps1
Created April 12, 2019 20:14
Powershell ping that displays response time in Windows taskbar
View tping.ps1
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 {
View gist:bfa6df9e6d69c5e5c7a5c63591ad2fcf
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);