TheoDeed TheoDeed - 5 months ago 20
Bash Question

Shell function error "invalid procedure call or argument"

After editing the batch file I want to run it. When I run it from the desktop, it runs properly, but from my program, I get the error:


invalid procedure call or argument


The batch file is in use until the VB6 program ends.

dRetVal = Shell("C:\Users\Theo\Desktop\BatchName.bat", vbMinimizedNoFocus)


What is wrong with this line? Or do you have other suggestions?
Thanks!

Answer

Batch files are run by C:\Windows\System32\CMD.EXE. CMD requires switches /c to run and exit and /k to keep running after the batch finishes. See cmd /?