Thread: redirecting...

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Location
    Kuala Lumpur, MY
    Posts
    18
    Rep Power
    0

    Question redirecting...


    i am a little bit confuse of redirecting command.

    If i run this direct in msdos command prompt, the output is dump inside the file specified.

    dir c:\ > "c:\dir.txt"

    BUT, i f i type this command line using 'run' from start menu, the output i want to redirect goes to a window rather than inside the file i have specified.

    Why is it .... can anyone help me...
  2. #2
  3. An Ominous Coward
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jan 2002
    Posts
    4,425
    Rep Power
    0
    I get an error when I run the command from a run dialog under XP. What OS are you using? Generally, I've found that using redirecting or "piping" under a windows system is highly unreliable. In some contexts, it seems to work like it should, in others, it fails mysteriously and without error.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Location
    Kuala Lumpur, MY
    Posts
    18
    Rep Power
    0
    after a long time, somebody answered to this. TQ ctb...
    I'm using win2k os. No wonder you have an error because 'dir' is prompt command. Acctually i don't want exactly to run 'dir', but another application, which is 'mysqldump'. After i try and error, i've found this...
    If i want to run from run start menu, i need to write this

    cmd /c "mysqldump plot > dump.sql" rather than only this....
    mysqldump plot > dump.sql

    is this a correct thing??
  6. #4
  7. An Ominous Coward
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jan 2002
    Posts
    4,425
    Rep Power
    0


    Yea, that works on XP.

    In particular, I was referring to using redirect within an application or script on NT.

    For example, if I execute this perl code:
    Code:
    `dir "c:/stupid_directory.txt"`
    Then IN THEORY, I believe that should create a file and write the directory contents to it (those backticks in perl mean "execute this shell program" which is a lot like typing it at the command prompt)... but it doesn't... it just makes an empty file calld "stupid_directory.txt".. never did figure out why.. just kludged it.

IMN logo majestic logo threadwatch logo seochat tools logo