Results 1 to 2 of 2

Thread: Use Shell Command to sort file In Visual Basic

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    brooklyn
    Posts
    48

    Post

    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!!!

  2. #2
    Hyperactive Member Al Smith's Avatar
    Join Date
    May 1999
    Location
    Marcellus, MI. USA
    Posts
    330

    Post

    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>


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width