Skip to content

Instantly share code, notes, and snippets.

@skyline75489
Last active December 17, 2020 10:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skyline75489/480d036db8ae9069b7009377e6eebb79 to your computer and use it in GitHub Desktop.
Save skyline75489/480d036db8ae9069b7009377e6eebb79 to your computer and use it in GitHub Desktop.
Windows Terminal OSC 9;9 for PowerShell
function prompt {
$p = $($executionContext.SessionState.Path.CurrentLocation)
$converted_path = Convert-Path $p
$ansi_escape = [char]27
"PS $p$('>' * ($nestedPromptLevel + 1)) ";
Write-Host "$ansi_escape]9;9;$converted_path$ansi_escape\"
}
@TBBle
Copy link

TBBle commented Sep 24, 2020

Yup, it supports that fine. Although I didn't create these directories.

PS C:\Users\paulh> [system.uri]("C:\dog%\cat#\mousewords")

AbsolutePath   : C:/dog%25/cat%23/mousewords
AbsoluteUri    : file:///C:/dog%25/cat%23/mousewords
LocalPath      : C:\dog%\cat#\mousewords
Authority      :
HostNameType   : Basic
IsDefaultPort  : True
IsFile         : True
IsLoopback     : True
PathAndQuery   : C:/dog%25/cat%23/mousewords
Segments       : {/, C:/, dog%25/, cat%23/…}
IsUnc          : False
Host           :
Port           : -1
Query          :
Fragment       :
Scheme         : file
OriginalString : C:\dog%\cat#\mousewords
DnsSafeHost    :
IdnHost        :
IsAbsoluteUri  : True
UserEscaped    : False
UserInfo       :

PS C:\Users\paulh> [system.uri]("C:\mẹ\母")

AbsolutePath   : C:/m%E1%BA%B9/%E6%AF%8D
AbsoluteUri    : file:///C:/m%E1%BA%B9/%E6%AF%8D
LocalPath      : C:\mẹ\母
Authority      :
HostNameType   : Basic
IsDefaultPort  : True
IsFile         : True
IsLoopback     : True
PathAndQuery   : C:/m%E1%BA%B9/%E6%AF%8D
Segments       : {/, C:/, m%E1%BA%B9/, %E6%AF%8D}
IsUnc          : False
Host           :
Port           : -1
Query          :
Fragment       :
Scheme         : file
OriginalString : C:\mẹ\母
DnsSafeHost    :
IdnHost        :
IsAbsoluteUri  : True
UserEscaped    : False
UserInfo       :

@j4james
Copy link

j4james commented Sep 24, 2020

Although I didn't create these directories.
AbsolutePath : C:/dog%25/cat%23/mousewords

If it wasn't you, there's a strong indication that your cat may have been responsible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment