Page 1 of 1

Console redirection (Windows)

Posted: Tue Jul 09, 2002 11:03 pm
by BackupUser
Code updated for 5.20+

Restored from previous forum. Originally posted by PB.

Code: Select all

; Console redirection example by PB -- do whatever you want with it.  :)
; This example outputs a list of files in "C:\Program Files" to a text file named "C:\Output.txt".
;
cmd$=Space(255) : GetEnvironmentVariable_("comspec",cmd$,255) ; Gets "command.com" (Win9x/ME) or "cmd.exe" (Win2K/XP).
out$="C:\Output.txt" : dir$="C:\Program Files\" ; Don't forget to include the trailing slash of the source directory!
ShellExecute_(0,"open",cmd$,"/c dir "+Chr(34)+dir$+"*.*"+Chr(34)+" > "+Chr(34)+out$+Chr(34),dir$,0)

PB - Registered PureBasic Coder

Edited by - PB on 10 July 2002 00:07:27

Posted: Wed Jul 10, 2002 6:41 am
by BackupUser
Restored from previous forum. Originally posted by Rings.

if you want to go indeep redirection and want some more control, use this:

viewtopic.php?t=3704

bt., PB your Tip is easier :)

Its a long way to the top if you wanna .....CodeGuru