Here's my vbs :
Myvar = "calc"
command = "powershell.exe -nologo -command Myvar"
set shell = CreateObject("WScript.Shell")
shell.Run command,0
It does not work. calc is not executed.
Later, i will substitue calc by a ps1 file with spaces. Can you help me? Thanks.
"... Myvar"
is just a quoted string, there is no substitution of the variable's value.
You need to concatenate the variable, to append the value from the variable, using the concatenation operator &
:
command = "powershell.exe -nologo -command " & Myvar