0

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.

1 Answer 1

2

"... 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
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.