wshshell.run/exec on Windows 10 RRS feed

  • General discussion

  • Hi

    I have an issue with windows 10/vbscript

    I have an environment that vbscript runs inside of another program (Diadem)

    In Windows 7 this works

    wshshell.run ("gsutil -m -q   cp """ & gspath & """ C:\FilesToProcess"   )

    However in Windows 10 it doesnt I have to use this construct

      dim commandfile:commandfile="C:\Diadem\" & filenamesrc & ".bat"
        Dim BatchFile : Set BatchFile = fso.OpenTextFile(commandfile,2,true)
    BatchFile.WriteLine "gsutil -m -q   cp """ & gspath & """ C:\FilesToProcess"   


    ie: exactly the same command

    exec has the same root issue

    Any ideas how to resolve


    • Changed type Bill_Stewart Tuesday, December 11, 2018 9:38 PM
    • Moved by Bill_Stewart Tuesday, December 11, 2018 9:38 PM This is not third-party support forum
    Thursday, July 26, 2018 1:51 PM

All replies

  • What does "however in Windows 10 it [sic] doesnt" mean?

    Why not use PowerShell instead of VBScript?

    -- Bill Stewart [Bill_Stewart]

    Thursday, July 26, 2018 3:09 PM
  • I am restricted by environment, it has to run within diadem which only supports vbscript

    Basically in either run or exec wshshell reports file not found.

    From a shell the command works, and as I said the exact same command works perfectly on my local machine which is windows 7

    I'm suspecting that windows 10 isnt respecting the path or blocking something

    Friday, July 27, 2018 9:09 AM
  • The issue is caused by how Diadem handles strings.  Contact diadem to see how they think you should code this when run under their version of the shell object (WSH) API.


    Friday, July 27, 2018 9:12 AM
  • Why would this be different in windows 10?

    Friday, July 27, 2018 10:04 AM
  • Many things have changed  in W10 for COM objects due to patches and COM restrictions. Also many bugs in string handling may cause issues with older software.

    The COM object that is used to execute VBS as an extension to a product is no longer supported by MS.  I would suspect that the vendor may have an old COM library or they may have other issues. Only the vendor can help with this.

    You can also suspect the embedded quotes.  Try using the 8.3 file name and you can eliminate the quotes.  This is, in effect, what the batch file does - it eliminates the embedded quotes.

    Example:  The 8.3 name for the "Programs Files" folder is "PROGRA~1"

    for your "gspath" just replace the folder that causes you to need quotes and remove the extra quotes.  Test this to see if it is only the embedded quotes.  If it is then tell the vendor to see if they have an alternate method.

    You should also try this:

    wshshell.run  "gsutil -m -q   cp \""" & gspath & "\"" C:\FilesToProcess" 

    Also try just this:

    wshshell.run  "gsutil -m -q   cp """ & gspath & """ C:\FilesToProcess" 

    You can get the error for the call like this:

    exitcode = wshshell.run ("gsutil -m -q   cp """ & gspath & """ C:\FilesToProcess"   )

    With the assignment, parens are legal.  Without the assignment the parens are an issue with VB languages.

    Any one of these things could get you a workabout for this.


    Friday, July 27, 2018 10:27 AM
  • This is not a support forum for your product unfortunately.

    You need to contact the vendor of your application for assistance.

    -- Bill Stewart [Bill_Stewart]

    Friday, July 27, 2018 2:54 PM
  • I have done more investigation


    1. I add "cmd" /c before the command it works

    2. If I run a gui program (notepad etc) it works

    Any "cmd" line program fails (even just "dir")

    Monday, July 30, 2018 10:31 AM
  • That is because you don't understand the difference between a program and a command.  Commands that are part of the CMD shell can only be run under the shell.  Programs "*.exe" can be run directly.  "dir" is not a program.  There is no such thing as "dir.exe".  It is an internal command.


    Monday, July 30, 2018 1:03 PM