Results 1 to 4 of 4

Thread: How can i Use paramters with Shell-Commands?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Posts
    3

    Question

    Hi!

    My big problem is, that I can't use all paramters when i execute a programm via SHELL.

    Example: I want to execute THIS

    netstat -n >net.txt

    which should execute netstat and write the output to a file.

    "Netstat -n" works fine, but ">" or ">>" does not work!

    Now I have to execute a batch file, which is not a very good solution.

    Thx for your help and time
    Daemon72

  2. #2
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Boulder, Colorado, USA
    Posts
    325
    redirects can't be done this way. You need to create a simple batch file which calls the program you want to run

    mynetstat.bat
    netstat.exe -n > net.txt
    EOF

    You can create this bat filedynamically in your program and kill the file when done, or just have a permenent bat file.
    -Shickadance

  3. #3
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    What you need is the CreateProcess API function...I can't give much more than that because I don't have that part of the Platform SDK on my computer. Where's Megatron?
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Not sure but shoud work shelling command.com
    Code:
    Shell "command.com netstat.exe -n > net.txt", vbMinimizedNoFocus
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width