Sign in to follow this  
Followers 0
blademonkey

Redirect Output

8 posts in this topic

Hey guys,

It's been a while since i've been in the forums.

I've done some research on this but i haven't seen anything conclusive.

Here's the deal.

I'm running some enterprise wide GPO loginscripts. I often update these scripts and will in the future open my code up for some other techs to make updates/changes. I am trying to redirect the standard error (and subsequent) outputs to write to a file or to console. The problem is that if, for any reason at all, a script is created/updated/changed and it causes some errors, EVERYONE that the GPO script applies to will be subject to a potential error message.

Please advise.

Thanks.

-Lawrence :think:


---"Educate the Mind, Make Savage the Body" -Mao Tse Tung

Share this post


Link to post
Share on other sites



I don't know what a GPO script is, but under the command intrepreter:

PROGRAM 1>StdOut.Txt 2>StdErr.Txt

this will run "PROGRAM" (BAT, COM, or EXE) and direct standard out to StdOut.Txt and standard error to StdErr.Txt

Share this post


Link to post
Share on other sites

I don't know what a GPO script is, but under the command intrepreter:

PROGRAM 1>StdOut.Txt 2>StdErr.Txt

this will run "PROGRAM" (BAT, COM, or EXE) and direct standard out to StdOut.Txt and standard error to StdErr.Txt

GPO = Group Policy Object.

GPO Script is a login script that is run at the Group Policy level as soon as users login or logoff. Unlike the traditional NT logon scripts, it supports UNC ,has no problem doing runas commands, and it completely invisible (i.e. no DOS/CMD window pops up).

The redirection I am looking for is autoit-centric. I am trying to redirect error popups from autoit to text files. For instance, if I were to compile the following code I would get the error message in the attached file:

msgbox(0,"tesT","there's a parenthesis missing"

I would like to redirect the error and standard output to a text file so that users will not see any potential errors.

hope that clears it up.


---"Educate the Mind, Make Savage the Body" -Mao Tse Tung

Share this post


Link to post
Share on other sites

GPO = Group Policy Object.

GPO Script is a login script that is run at the Group Policy level as soon as users login or logoff. Unlike the traditional NT logon scripts, it supports UNC ,has no problem doing runas commands, and it completely invisible (i.e. no DOS/CMD window pops up).

The redirection I am looking for is autoit-centric. I am trying to redirect error popups from autoit to text files. For instance, if I were to compile the following code I would get the error message in the attached file:

msgbox(0,"tesT","there's a parenthesis missing"

I would like to redirect the error and standard output to a text file so that users will not see any potential errors.

hope that clears it up.

OK, MsgBox is not an output function, it's a GUI function. There is no easy way to "redirect it" without hooking into the GUI or writing another external watcher script.

The best way to not see those errors is to go through your code and replace the MsgBox function calls with something else, for example use FileWrite to write your errors to a log file or something.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

OK, MsgBox is not an output function, it's a GUI function. There is no easy way to "redirect it" without hooking into the GUI or writing another external watcher script.

The best way to not see those errors is to go through your code and replace the MsgBox function calls with something else, for example use FileWrite to write your errors to a log file or something.

I'm not trying to redirect the msgbox output, just the error output from the script.

If you compile the code and run it, you will see what I mean. Msgbox was just an example, if you have been a bad if statement

if 1 then
Edited by blademonkey

---"Educate the Mind, Make Savage the Body" -Mao Tse Tung

Share this post


Link to post
Share on other sites

Oh yeah, well, the solution to that is to write code that doesn't throw errors! :think:

Share this post


Link to post
Share on other sites

Oh yeah, well, the solution to that is to write code that doesn't throw errors! :think:

I'll try to remember that line when you, yourself, get errors :(.


---"Educate the Mind, Make Savage the Body" -Mao Tse Tung

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

To save a absolute mistake shown when in public view, then /ErrorStdOut may help. Logging would be a different story.

Edit:

Reference link

Edited by MHz

Share this post


Link to post
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
Sign in to follow this  
Followers 0