1

here is my VBScript

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "C:\Program Files\TrueCrypt\TrueCrypt.exe", 0 , false

It says it can't find it.

mrN
  • 3,734
  • 15
  • 58
  • 82
  • possible duplicate of [VBScript problem](http://stackoverflow.com/questions/5156903/vbscript-problem) – Helen Jul 28 '11 at 09:25
  • possible duplicate of [Launch programs whose path contains spaces](http://stackoverflow.com/questions/1340355/launch-programs-whose-path-contains-spaces) – Jean-François Corbett Mar 12 '15 at 08:10

3 Answers3

1

Taken from here

You can get around this by surrounding the path in quotes. But to do so, you need to escape them correctly(with "), so:

WshShell.Run """C:\Program Files\TrueCrypt\TrueCrypt.exe"""
Community
  • 1
  • 1
Sandeep Pathak
  • 10,567
  • 8
  • 45
  • 57
  • This gives error. `Cannot use parenthesis while calling a sub` – mrN Jul 28 '11 at 09:00
  • Ok, got that working, but my code tells to open the application hidden, but not in windows vista – mrN Jul 28 '11 at 09:42
  • Will you plz elaborate ? Second Argument has a control over hidden attribute . Do you want no hide behaviour for vista? – Sandeep Pathak Jul 28 '11 at 09:51
  • Here is the question referring to the problem > [here](http://stackoverflow.com/questions/6857308/run-any-application-in-background) – mrN Jul 28 '11 at 10:16
0

You can try the following:

    Dim objShell
    Set objShell = WScript.CreateObject( "WScript.Shell" )
    objShell.Run("""C:\Program Files\TrueCrypt\TrueCrypt.exe""")
    Set objShell = Nothing
Sunny
  • 1
0

Either put more quotes around the path, or use the old style string for "Program Files" - Progra~1.

The following example works on my machine:

<package>
    <job id="truecrypt">
        <script language="VBScript">
            set WshShell = WScript.CreateObject("WScript.Shell")
            WshShell.Run """C:\Program Files\TrueCrypt\TrueCrypt.exe""", 0 , false
        </script>
    </job>
</package>
Jon Egerton
  • 40,401
  • 11
  • 97
  • 129
  • Would you take a look at [this question](http://stackoverflow.com/questions/6857308/run-any-application-in-background) too – mrN Jul 28 '11 at 10:17