Shell Command Fails (sometimes)

D

Daniel

I have been using the shell command often this way:

Shell Environ("comspec") & " /c " & ProgramFile & " <" & InFile & " >" &
OutFile, vbNormalFocus

Sometimes it works and sometimes it does not (within the same directory, the
path is OK.) It does not seem to be reading the input file of the executable.

any ideas?

Thanks
Dan
 
R

Rick Rothstein \(MVP - VB\)

Is it failing when the filename or its path contains blank spaces in them?
Try this...

Shell Environ("comspec") & " /c """ & ProgramFile & _
""" <""" & InFile & _
""" >""" & OutFile & """", vbNormalFocus

Rick
 
R

Rick Rothstein \(MVP - VB\)

When you say it doesn't work... what does that mean? When it doesn't work,
do you get any kind of indication that it didn't work? Do you get an error
(if so, what is the error message)? Does something happen, but not what you
expect? Does nothing happen?

Oh, I have to ask... you are use paths with your filenames, right?

Rick
 
D

Daniel

Q1)When you say it doesn't work... what does that mean?
A1) The desired results does not happen, the exe is not executed

Q2) When it doesn't work, do you get any kind of indication that it didn't
work?
A2) yes, the dos screen flashes (open/close) however the exe is not
executed, no error message to work with, no error message in the output file
(when the exe runs it generates an out file), this means the exe did not kick
in, why, that is what I am trying to find out

and the problem is that this is intermittent, sometimes it works and
sometimes it does not,

sorry I am really disconcerted with this
any other ideas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top