Re: Shell Command Doesn't Create TXT file as expected



Andibevan wrote:
>
> Hi All,
>
> I am having problems using the shell command to write the output of a dos
> command to a text file.
>
> I would be really grateful if someone could tell me why this doesn't produce
> the required Test.txt file?
>
> Sub Test
>
> Shell ("dir >C:\test.txt")
>
> End sub
>
> I get the error "File Not Found"

Because Shell is looking for an executable of the name "dir.com" or
"dir.exe" in the path. Dir is an internal command.

> What is the correct syntax to write a dos command to a file using Shell?

Shell ("command.com /c dir > C:\temp\test.txt")
.



Relevant Pages

  • Re: Shell to Command
    ... > I have a VB6 program that shells to the dos prompt then opens an ftp ... > manually start a dos session and type in the command line ftp, ... Am I missing something in the shell function? ...
    (microsoft.public.vb.syntax)
  • Re: useing paramters with shell
    ... regarding the Shell command. ... You can use the Shell command. ... To execute internal DOS command (Dir, ... Specifying the command processor is safe & generic and ...
    (microsoft.public.vb.general.discussion)
  • Bash-4.0 available for FTP
    ... Unlike previous bash distributions, this tar file includes the formatted ... The shell has been changed to be more ... rigorous about parsing commands inside command substitutions, ... Changes have been made to the Readline library being released at ...
    (gnu.announce)
  • Why newbies dont RTFM...
    ... Even though I've used Linux before, I've never had to do any ... BASH BUILTIN COMMANDS ... last command exited within ... unless the shell is not exeâ ...
    (comp.os.linux.misc)
  • Re: Great SWT Program
    ... None of the nasty things that you have said or implied about me are at ... treat the file as input (manually invoking the command interpreter ... script, copy the line into that within the editor, exit, and invoke ... the shell script. ...
    (comp.lang.java.programmer)

Loading