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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Redirect output from CLI command

phartwig
13-Aquamarine

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

ACCEPTED SOLUTION

Accepted Solutions
mrump
16-Pearl
(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
16-Pearl
(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
13-Aquamarine
(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
12-Amethyst
(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 🙂

Announcements


Top Tags