home *** CD-ROM | disk | FTP | other *** search
- @echo OFF
- REM ****************************************************
- REM *** Tee.cmd - Capture text-mode screen output of ***
- REM *** a command to a file ***
- REM ****************************************************
-
- if not "%2"=="" GOTO DO_TEE
- ECHO Tee.cmd - Pipe command output to screen AND to a file
- ECHO USAGE: Tee CaptureFile Commands....
- ECHO WHERE: CaptureFile - Name of file to capture text to
- ECHO Commands - Any executable commands
- ECHO EXAMPLE: Tee DirSave.txt dir *.exe
- GOTO TEE_DONE
-
- :DO_TEE
- %2 %3 %4 %5 %6 %7 %8 %9 | CEnvi %0.cmd %1
- GOTO CENVI_EXIT
-
- main(argc,argv)
- {
- fp = fopen(argv[1],"w"); // open file for output
- if ( !fp )
- printf("Could not open file \"%s\" for output\n",argv[1]);
- else {
- // read in each line, and send to file and screen
- while ( line=gets() ) {
- printf("%s\n",line)
- fprintf(fp,"%s\n",line)
- }
- fclose(fp)
- }
- }
-
- :CENVI_EXIT
- :TEE_DONE