cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Redirect output from CLI command

phartwig
12-Amethyst

Redirect output from CLI command

Hello,

Has anyone discovered a way to redirect the ouput from the CLI to a log file? I would like to redirect the ID and/or any errors from the command window to a text file that can be viewed at a later time. I have tried "im createissue .... >log.txt" with no results entered in the txt file.

Thank You,

Paul

1 ACCEPTED SOLUTION

Accepted Solutions
mrump
14-Alexandrite
(To:phartwig)

Hi Paul,

the problem is that some of the CLI commands return on STDERR while other messages come through STDOUT.

So to be shure you get all the output you would see in the shell in your log-file, you'll have to redirect both streams

e.g.

"im createissue .... >log.txt 2>&1

HTH Matthias

View solution in original post

3 REPLIES 3
mrump
14-Alexandrite
(To:phartwig)

Hi Paul,

the problem is that some of the CLI commands return on STDERR while other messages come through STDOUT.

So to be shure you get all the output you would see in the shell in your log-file, you'll have to redirect both streams

e.g.

"im createissue .... >log.txt 2>&1

HTH Matthias

phartwig
12-Amethyst
(To:mrump)

Matthias,

Thank you for the help. I am now getting an entries in the log file, but it they are comming in like the following:

牃慥楴杮倠潲牧浡删煥極敲敭瑮⸠⸮ഠ⨊⨪䌠畯摬渠瑯猠癡⁥瑩浥›䭍ㅓ㐲㔲㨰䘠敩.....

Do you have any ideas why this would be happening?

Thank You,

Paul

tketz
4-Participant
(To:phartwig)

Hi Paul,

Matthias is right. That's the way to Pipe your cmd output into a file.

It's described in the www when you search for "technet using command redirection operators".

I'm not sure what you've done to get this output 🙂

Top Tags