To make life easier, i usually use this function to add the double quotes in a variable.
Function DblQuote(Str)
DblQuote = Chr(34) & Str & Chr(34)
End Function
An example showing you how it is easy to use it.
Option Explicit
Dim fso,ws,DossierProgramfiles,Winrar,FileZilla,FireFox
Set fso = CreateObject("Scripting.FileSystemObject")
Set ws = CreateObject("WScript.Shell")
DossierProgramfiles = ws.ExpandEnvironmentStrings("%PROGRAMFILES%")
Winrar = DblQuote(DossierProgramfiles & "\Winrar\Winrar.exe")
If fso.FileExists(DossierProgramfiles & "\Winrar\Winrar.exe") Then
MsgBox Winrar,Vbinformation,Winrar
ws.run Winrar
Else
MsgBox "Le fichier " & Winrar & " n'existe pas",VbCritical,"Le fichier " & Winrar & " n'existe pas"
End If
FileZilla = DblQuote(DossierProgramfiles & "\FileZilla FTP Client\filezilla.exe")
If fso.FileExists(DossierProgramfiles & "\FileZilla FTP Client\filezilla.exe") Then
MsgBox FileZilla,Vbinformation,FileZilla
Ws.run FileZilla
Else
MsgBox "Le fichier " & FileZilla & " n'existe pas",VbCritical,"Le fichier " & FileZilla & " n'existe pas"
End If
FireFox = DblQuote(DossierProgramfiles & "\Mozilla Firefox\FireFox.exe")
If fso.FileExists(DossierProgramfiles & "\Mozilla Firefox\FireFox.exe") Then
MsgBox FireFox,Vbinformation,FireFox
ws.run FireFox
Else
MsgBox "Le fichier " & FireFox & " n'existe pas",VbCritical,"Le fichier " & FireFox & " n'existe pas"
End If
'****************************************************************************************************
Function DblQuote(Str)
DblQuote = Chr(34) & Str & Chr(34)
End Function
'****************************************************************************************************