PDA

Click to See Complete Forum and Search --> : interesting question


sanford101
Jan 19th, 2000, 09:09 AM
I want to use the shell command to sort a simple text file. here is the code:

dim strCommandLine as string
dim sngMark as single
strCommandLine=App.path &"\" & batchFile
shell strCommandLine, vbMinimizedFocus

sngMark=timer
do
DoEvents
Loop Until timer-sngMark>5 'or 10 to let it 'do its jod

The batchfile is following:
c:\winnt\system32\sort.exe <somefile> anyfile

here the somefile is just simple text file.
The problem is that after the vb program, there is no "anyfile" being generated. But I can generated 'anyfile' if I do that batchfile in Dos systems.
I really really really want to know why. please Help, Thank you for reading. Thanx a lot for answering.

Mark Sreeves
Jan 19th, 2000, 08:16 PM
Hmm this looks familiar:0
http://www.vb-world.net/ubb/Forum1/HTML/013787.html

------------------
Mark Sreeves
Analyst Programmer

Mark.Sreeves@Softlab.co.uk
A BMW Group Company

HarryW
Jan 19th, 2000, 08:24 PM
Hmm, group deja vu :D

Jan 19th, 2000, 09:40 PM
mhh.. seems to be ok. but change your do .. loop :
(this routine needs lower cpu-time)

[modul]
Public Declare Sub Sleep Lib "kernel32" _(ByVal dwMilliseconds As Long)

[YOUR SUB or FUNCTION]
dim strCommandLine as string
dim sngMark as single
strCommandLine=App.path &"\" & batchFile
shell strCommandLine, vbMinimizedFocus

sngMark=timer
do
DoEvents
sleep 200 'your programm now wait 0,2 sec
Loop Until timer-sngMark>5