-
I have this trouble to use shell command to sort a simple text file from Visual Basic:
Here is the Visual Basic code:
Private sub CmdSort_click()
dim StrCommandLine as string
StrCommandLine=App.Path & "\Zsortsum.bat"
shell strCommandLine, vbMinimized
end sub
The batch file "Zsortsum.bat" is following:
c:\winnt\system32\sort.exe <c:\smy.tmp> c:\sumdoc.srt
The problem is that I can not get the file
sumdoc.srt generated ( or created) after I executed the Visual basic program( there is not error message in VB) . I can have the sumdoc.srt file generate if I use the batch file in DOS system. Could you tell me why? Thanks a lot!!!
-
You might be running into the following:
The shell command doesn't wait for the shelled program to finish before moving on to the next VB commands. Here is a tip in this site that shows you how to shell a program, particularly Dos, and then not continue until the Dos program has finished.
http://www.vbsquare.com/tips/tip280.html
Al.
------------------
A computer is a tool, not a toy.
<A HREF="mailto:[email protected]
[email protected]">[email protected]
[email protected]</A>