Wrong encoding with powershell shell command

Viewed 36

I setup my powershell so I can drag and drop files on .ps1 files and start the script with the file paths as arg parameters.

I set a default key to

\HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\Open\Command

Default key

"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -File "%1" %*

But this command can't handle files with cyrillic or japanese characters. For example, create a test.ps1 file:

foreach ($arg in $args) {
    Write-Host "$arg"
}
pause

and I start this script like this:

powershell -File test.ps1 "ダーク" "Олег"

I get this result:

PS C:\Users\...\Desktop> powershell -File test.ps1 "ダーク" "Олег"
???
????

Is there an alternative command I can set to start a script or is there a way to force an encoding for this command?

0 Answers
Related