-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MicroWin: fixing German and Spanish bugs (#1194)
* Fixing German and other languages local issue, also doing some house keeping * Fixed several Microwin bugs * Fixing local bug and adding copy to USB feature * Adding driver injection capabilities and fixing bugs in Microwin --------- Co-authored-by: KonTy <KonTy@github.com>
- Loading branch information
Showing
9 changed files
with
1,016 additions
and
802 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
function Get-LocalizedYesNo { | ||
<# | ||
.SYNOPSIS | ||
This function runs takeown.exe and captures its output to extract yes no in a localized Windows | ||
.DESCRIPTION | ||
The function retrieves lines from the output of takeown.exe until there are at least 2 characters | ||
captured in a specific format, such as "Yes=<first character>, No=<second character>". | ||
.EXAMPLE | ||
$yesNoArray = Get-LocalizedYesNo | ||
Write-Host "Yes=$($yesNoArray[0]), No=$($yesNoArray[1])" | ||
#> | ||
|
||
# Run takeown.exe and capture its output | ||
$takeownOutput = & takeown.exe /? | Out-String | ||
|
||
# Parse the output and retrieve lines until there are at least 2 characters in the array | ||
$found = $false | ||
$charactersArray = @() | ||
foreach ($line in $takeownOutput -split "`r`n") | ||
{ | ||
if ($found) | ||
{ | ||
$characters = $line -split '(")([A-Za-z])(")' | Where-Object { $_ -match '^[A-Za-z]$' } | ||
$charactersArray += $characters | ||
|
||
if ($charactersArray.Count -ge 2) | ||
{ | ||
break | ||
} | ||
} | ||
elseif ($line -match "/D ") | ||
{ | ||
$found = $true | ||
} | ||
} | ||
|
||
Write-Debug "According to takeown.exe local Yes is $charactersArray[0]" | ||
# Return the array of characters | ||
return $charactersArray | ||
} |
Oops, something went wrong.