Is Unicode displayed with the name Folder? at the wscript prompt

I ran into problems with folders with Unicode names. When I drag the folder into the script folder, it does not show the folder path correctly.

Simple VBScript (this is only part of it):

Dim Wshso : Set Wshso = WScript.CreateObject("WScript.Shell")
Dim FSO : Set FSO = CreateObject("Scripting.FileSystemObject")

If WScript.Arguments.Count = 1 Then
    If FSO.FileExists(Wscript.Arguments.Item(0)) = true and FSO.FolderExists(Wscript.Arguments.Item(0)) = false Then
        Alert "You dragged a file, not a folder! My god." & vbcrlf & "Script will terminate immediately", 0, "Alert: User is stupid", 48
        WScript.Quit
    Else
        targetDir = WScript.Arguments.Item(0)
        Wshso.Popup targetDir
    End If
Else
    targetDir = Wshso.SpecialFolders("Desktop")
    Alert "Note: No folder to traverse detected, default set to:" & vbcrlf & Wshso.SpecialFolders("Desktop"), 0, "Alert", 48
End If

If this is a normal path without Unicode characters, this is normal. But in this case: Directory:4minute (포미닛) - Hit Your Heart

Then it will show something like 4minute (?) - Hit Your Heart

And if I do FolderExists, it cannot find the shuffled folder.

Is there a workaround for Unicode support called Folders?

Thank!

I will edit if it is not clear enough

+3
source share
2 answers

, Windows Script Host DropHandler. :

test.vbs "C:\포미닛.txt"
C:\WINDOWS\System32\WScript.exe "test.vbs" "C:\포미닛.txt"

( Hangul , ?), , , Unicode- > ANSI- > Unicode , , ANSI. (So ​​포미닛 , .)

, . , , DropHandler .vbs :

HKEY_CLASSES_ROOT\VBSFile\ShellEx\DropHandler\(Default)

WSH DropHandler ({60254CA5-953B-11CF-8C96-00AA00B8708C}) {86C86720-42A0-1069-A2E8-08002B30309D}, , .exe,.bat .., . , , .vbs, filename, EXE DropHandler , .

VBS, , . , , DropTarget, VBSFile? , , forgo drop-on- script Open dialog .

+3

, Google...

, vbscript (myscript.vbs) dos (mybatch.bat).

:

", , Windows Script Host DropHandler, ... , .exe,.bat ... ".

mybatch.bat :

:Loop
IF "%1"=="" GOTO Continue
     set allfiles=%allfiles% "%1"
SHIFT
GOTO Loop
:Continue
"myscript.vbs" %allfiles%

myscript.vbs,

For Each strFullFileName In Wscript.Arguments
  ' do stuff
Next
+1

Source: https://habr.com/ru/post/1778714/


All Articles