get the folder name of where the script is stored.
hi,
i have test file (am new powershell);
$mydir = $psscriptroot write-host "executing following directory: $mydir"
which me outputs;
c:\users\user\downloads
what need output, top folder only, no full path, eg. downloads (where script physically located)
and not display c:\users\user\ portion
the closest got using -noqualifier option, omits c: part
is there direct way call this, or maybe through replace/manipulating text?
many thanks
$psscriptroot | split-path -leaf
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Windows Server > Windows PowerShell
Comments
Post a Comment