1

I can compile my visual basic project Project1.vbp into exe through this command

Set objWshScriptExec=objShell.Exec("cmd.exe /S /C cd ""C:\Program Files (x86)\Microsoft Visual Studio\VB98"" & vb6/make ""C:\Users\Ankit\Desktop\New folder (5)\Project1.vbp"" ""C:\Users\Ankit\Desktop\New folder (5)\Project1.exe""")

But when I take

p="C:\Program Files (x86)\Microsoft Visual Studio\VB98"
m="C:\Users\Ankit\Desktop\New folder (5)\"

And try to execute this command

Set objWshScriptExec=objShell.Exec("cmd.exe /S /C cd "p" & vb6/make "m"Project1.vbp"" "m"Project1.exe""")

It results in error.

kindly provide me some solution to correct this command to compile the project to exe.

1 Answers1

2

You have to concatenate strings using & and also enclose your paths in " quotes. (Inside a string, quotes are escaped as "".)

Set d = objShell.Exec("cmd.exe /S /C cd """ & p & """ & vb6/make """ _
    & m & "Project1.vbp"" """ & m & "Project1.exe""")
Jean-François Corbett
  • 37,420
  • 30
  • 139
  • 188