print DOS outputs (1 Viewer)

ajetrumpet

Banned
Local time
Yesterday, 23:54
Joined
Jun 22, 2007
Messages
5,638
does anyone know if there is a way that I can print the output of a DOS command through VBA?

I have tried this:
Code:
dir > dirs.txt

I am in the correct local directory and the file does exist. The problem is that it tells me that the file transfer is complete, but the text file always turns up empty. If there is a way I can get this in a text file, or even better, into the VBA window by the "debug.print" method, I would be greatful. thanks all!
 
Last edited:
Local time
Yesterday, 23:54
Joined
Mar 4, 2008
Messages
3,856
Try doing a "DoEvents" before opening the file. Maybe put a pause in the Subroutine, too.
 

ajetrumpet

Banned
Local time
Yesterday, 23:54
Joined
Jun 22, 2007
Messages
5,638
Try doing a "DoEvents" before opening the file. Maybe put a pause in the Subroutine, too.
george, did you understand what I was asking? I want to view the DOS window's text in the VBA window. How does a pause and a doEvents help? sorry, but I think I was unclear.

and also, I have since learned that this yields something of interest:
Code:
DIR *.* /b > Dirs.txt
when i type that in, I get this output, but I don't know what it means, but I think I'm close to getting what I want:
Code:
Usage: dir remote directory local file
 

ajetrumpet

Banned
Local time
Yesterday, 23:54
Joined
Jun 22, 2007
Messages
5,638
I'm not sure what you're doing.
basically george, when I type DIR in the command line, I want to see the directory and file list in a local txt file on my computer instead of in the DOS window. does that make sense now?

George, the following works just fine in normal DOS mode (e.g. - CMD.EXE):
Code:
dir *.* /b >dirs.txt
that writes the directory and all of it's contents to the text file, but what I want is for that same command to work in FTP mode. Do you know if this is possible?
 
Last edited:
Local time
Yesterday, 23:54
Joined
Mar 4, 2008
Messages
3,856
You can output the entire ftp session to a file and use the ls (or in some ftps, dir) command to get a directory listing.
 

ajetrumpet

Banned
Local time
Yesterday, 23:54
Joined
Jun 22, 2007
Messages
5,638
You can output the entire ftp session to a file and use the ls (or in some ftps, dir) command to get a directory listing.

LS is a list command and I tried to manipulate that but couldn't figure out the command to output the list. LS on my vista machine only displays a list of files in the DOS window. Should I use the same command as I am now using with my local DOS process? Is that what you're saying?

I have just tried this george:
Code:
ls > dir.txt
it created a text file but didn't put anything in it. did I miss something?
 

mcclunyboy

Registered User.
Local time
Yesterday, 21:54
Joined
Sep 8, 2009
Messages
292
edited - sorry i just realised i have repeated what someone else typed.
 

Users who are viewing this thread

Top Bottom