Last active
August 3, 2022 20:26
-
-
Save saggie/0912a5be33d6f5f7f3da53e394528a4e to your computer and use it in GitHub Desktop.
Replacing slash and backslash in the clipboard by PowerShell. ref: http://qiita.com/saggie/items/ed7ad06d2e4e1ede676d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-Type -AssemblyName System.Windows.Forms | |
$clipText = [Windows.Forms.Clipboard]::GetText() | |
if ($clipText.Contains('/')) | |
{ | |
$replacedClipText = $clipText -replace '/', '\' | |
[Windows.Forms.Clipboard]::SetText($replacedClipText) | |
} | |
elseif ($clipText.Contains('\')) | |
{ | |
$replacedClipText = $clipText -replace '\\', '/' | |
[Windows.Forms.Clipboard]::SetText($replacedClipText) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment