Re: redirection



Certainly. Use the SHELL command. Assuming that you're using QBASIC,
something like the following should work.

-- Begin code -----
OPEN "TheFile.txt" FOR INPUT AS #1
DO WHILE NOT EOF(1)
LINE INPUT #1, F$
SHELL "xcopy " + F$ + " DestFldr"
LOOP
CLOSE #1
SYSTEM
-- End Code -----

It's not every efficient though. A better method might be to get BASIC
to write a batch file from the original text file and SHELL to that.

-- Begin code -----
OPEN "Temp.bat" FOR OUTPUT AS #2
OPEN "TheFile.txt" FOR INPUT AS #1
DO WHILE NOT EOF(1)
LINE INPUT #1, F$
PRINT #2, "xcopy " + F$ + " DestFldr"
LOOP
CLOSE #1
CLOSE #2
SHELL "cmd /c temp.bat"
SYSTEM
-- End Code -----

Warning! I have just thrown those two together as examples. Neither has
been tested so I may have included some silly mistake or typo which
prevents them from working without minor fixes. But on the other hand,
I might not. They are just intended as pointers indicating how to call
DOS programs like "xcopy" from BASIC.

Cheers

Derek

.



Relevant Pages

  • Re: SHELLing
    ... batch file which first copies a file to the c:\temp directory and my VB ... loop until the file exists in c:\temp and then loop until ... >> user using a form and then SHELL out to run a compression program ... >> Kansas City Regional Office ...
    (microsoft.public.vb.general.discussion)
  • Re: Application starts too soon
    ... each shell internal implementation. ... >>> The application runs froma a batch file. ... >>> shutdown command times out and the computer is ready to be turned off. ... >>> think the app tries to run, encounters an error, and exits. ...
    (microsoft.public.windowsxp.embedded)
  • Re: Launch a .bat file with VBA
    ... Thanks Tom. ... That seems to run the batch file, ... the Shell function runs other programs ... shell command to launch programs, but that doesn't seem to be working ...
    (microsoft.public.excel.programming)
  • Re: Environment Space in XP
    ... As soon as you 'run' your batch file the 'Shell' containing those settings ... You cannot set up a DOS environment like that unless you execute an app ... When I executed a DOS box, it again showed 'Out of environment space' but I ...
    (comp.lang.clipper)
  • Re: directory listing, mp3 files
    ... I have to shell a new comand prompt then pass the code one line at a ... Since Shell can only process one command line, ... probably execute the batch file from the Shell command and, ... argument to the Shell command, pass in the appropriate text strings for the ...
    (comp.lang.basic.visual.misc)