Blog Syntax Highlighter
Testing Syntax Highlighter for the blog with some random PowerShell code.
The code allow you to set a program “always on top”
# Your executable here # $exe = "notepad" $exe = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" function Set-TopMost($handle) { $FnDef = ' [DllImport("user32.dll")] public static extern bool SetWindowPos(int hWnd, int hAfter, int x, int y, int cx, int cy, uint Flags); '; $user32 = Add-Type -MemberDefinition $FnDef -Name 'User32' -Namespace 'Win32' -PassThru $user32::SetWindowPos($handle, -1, 0,0,0,0, 3) } $pname = [System.IO.Path]::GetFileNameWithoutExtension($exe) $p = (Get-Process $pname -ErrorAction "SilentlyContinue") | ? { $_.MainWindowHandle -ne 0 } if ($p -eq $null) { Write-Host "Process '$pname' not found, starting: $exe" & $exe Write-Host "Waiting for process '$pname'" while ($p -eq $null) { sleep -Milliseconds 100 $p = (Get-Process $pname -ErrorAction "SilentlyContinue") | ? { $_.MainWindowHandle -ne 0 } } }

I’m a Belgian man in the mid thirty, currently working as the UCC Team Lead at Orbid NV. I’ve focussed my technical career towards becoming an expert in Unified Communication and Collaboration, working mostly within the Microsoft eco-system (Teams, Skype For Business, Exchange).