Click to See Complete Forum and Search --> : About the shelling


January 30th, 2000, 05:26 PM
Basically I try to use the shell command to
sort a simple text file and generate another file.

My visual basic code is following:

Private sub Command1_click( )
Dim strCommand as string
Dim sngMark as single

StrCommand=app.path & “\sortSum.bat”

Shell strCommand, vbMinimizedNoFocus

SngMark=timer
Do
DoEvents
Loop until timer-sngMark>2
End sub

The batch file sortSum.bat is following:
C:\winnt\system32\sort <c:\somefile> c:\outputFile
(or sort <c:\somefile> c:\outputFile)

somefile is just a simple text file I want to be sorted.

The problem is that there is no outputfile be generated after
running the click event.. But if I execute the batch file (sortsum.bat) in the
Dos system, there is outputfile being generated. I also used the CreateProcess function
And WaitForObjectCreated Api function to do the batch files
And everything went well and just no file being created.

does anybody know why? I have been burdened
with this problem for several days. Please heellp.

Thanks a lot.