wso.Exec returns wrong file name if executing dir command RRS feed

  • General discussion

  • I have a file in a folder with the name


    When I do a "dir" on that folder, the file  name lists properly. However, in vbScript if I do

        set wso = CreateObject("Wscript.Shell")
        set exe = wso.Exec("cmd /c dir /b no*.jpg")
        Wscript.Echo exe.StdOut.ReadAll

    the file lists as

    So if I use Exec to get a list of file names (much easier when using wildcards), I can't rely on getting the actual names of the files. I'd say this is a bug, unless there is a setting I am overlooking that would manage the "funny" characters which are actually valid in the file names.    
    • Changed type Bill_Stewart Wednesday, September 5, 2018 10:07 PM
    • Moved by Bill_Stewart Wednesday, September 5, 2018 10:08 PM User didn't ask a question
    Sunday, July 8, 2018 3:47 PM

All replies

  • This is due to character encoding in console.

    Other than that, I don't see a question in your post.

    -- Bill Stewart [Bill_Stewart]

    Sunday, July 8, 2018 6:14 PM