Last active
August 29, 2015 14:17
-
-
Save somian/1d53c33be978207239d1 to your computer and use it in GitHub Desktop.
Problem with output
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
@ECHO OFF | |
:: Use PS to split env PATH into separated pathelements | |
:: Run test in Vim :!%:p:h:8/%:r.%:e | |
POWERshell -File .\Tighties.ps1 | |
:EOF |
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
$MethodDefinition = @' | |
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)] | |
public static extern int GetShortPathName(string LongPath, string ShortPath, int Buflen); | |
'@ | |
$Kernel32 = Add-Type -MemberDefinition $MethodDefinition -Name 'Kernel32' -Namespace 'Win32' -PassThru | |
$oi = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | |
foreach ($pt in $Env:PATH.split(';')) { | |
$snap = $Kernel32::GetShortPathName("$pt" , $oi, 9056) | |
write-host "Pathname $oi" | |
$oi = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | |
} | |
# This script is called from a CMD batch file -- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment