Jump to content

_RunDOS() Piping


Recommended Posts

I think maybe the _RunDos() Functions needs a little bit more information, instead of just the example. Maybe this to start.

Return Value:

Success - Returns the exit code of the command

Failure - Depends on RunErrorsFatal setting

Remarks: When piping DOS (console) commands, to a file, you must use the 8.3 short path+name(Shortname) as the destination.

Related: Run, RunAsSet

Examples:

; Ex. #1:

#include <Process.au3>

$rc = _RunDos("start Http://www.autoitscript.com")


; Ex. #2:

#include <Process.au3>

$rc = _RunDos("dir > " & FileGetShortName(@ScriptDir) & "temp.txt") 
;Pipes the 'dir' command to "temp.txt", located in the running script directory

Edit: Then again maybe it should be up to the user to know they need to use the shortname, and then the above information could/should/might be included in the remarks for Run() as it does comment on how to run DOS commands.

Edited by Burrup

qq

Link to comment
Share on other sites

You don't technically need the short name. You just need to make sure that any paths containing spaces are enclosed in quotes.

; Ugly, but should work:

_RunDos('dir > "' & FileGetShortName(@ScriptDir) & '\temp.txt"')

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

I think maybe the _RunDos() Functions needs a little bit more information, instead of just the example. Maybe this to start.

Remarks: When piping DOS (console) commands, to a file, you must use the 8.3 short path+name(Shortname) as the destination.

$rc = _RunDos("dir > " & FileGetShortName(@ScriptDir) & "temp.txt")

;Pipes the 'dir' command to "temp.txt", located in the running script directory

> Redirects output.

| Pipes input to output.

:)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...