Chuy?n h?ng cc thng bo l?i t? d?u nh?c l?nh: STDERR/STDOUT

D?ch tiu ? D?ch tiu ?
ID c?a bi: 110930 - Xem s?n ph?m m bi ny p d?ng vo.
Bung t?t c? | Thu g?n t?t c?

? Trang ny

TM T?T

Khi chuy?n h?ng ?u ra t? m?t ?ng d?ng b?ng cch s? d?ng cc ">" bi?u t?ng, l?i cc tin nh?n v?n c?n in mn h?nh. i?u ny l do thng bo l?i l th?ng xuyn ?c g?i ?n d?ng tiu chu?n l?i thay v? tiu chu?n trong d?ng.

?u ra t? m?t ?ng d?ng giao di?n i?u khi?n (Command Prompt) ho?c l?nh th?ng ?c g?i ? hai d?ng ring bi?t. ?u ra th?ng xuyn ?c g?i t?i tiu chu?n ra (STDOUT) v cc thng bo l?i s? ?c g?i ?n l?i chu?n (STDERR). Khi b?n chuy?n h?ng giao di?n i?u khi?n ?u ra b?ng cch s? d?ng cc ">" bi?u t?ng, b?n ang ch? chuy?n h?ng STDOUT. ? chuy?n h?ng STDERR b?n ph?i ch? ?nh "2 >" cho cc bi?u t?ng chuy?n h?ng. i?u ny l?a ch?n th? hai s?n l?ng d?ng l STDERR.

V D?

L?nh "dir file.xxx" (ni file.xxx khng t?n t?i) s? hi?n th? cc s?n l?ng sau:
Kh?i l?ng trong ? f l Candy Cane Kh?i l?ng Serial Number l 34EC-0876

Khng t?m th?y t?p
N?u b?n chuy?n h?ng ?u ra ? s? d?ng thi?t b? NUL "dir file.xxx > nul", b?n v?n s? th?y thng bo l?i:
Khng t?m th?y t?p
? chuy?n h?ng cc thng bo l?i ? NUL, s? d?ng l?nh sau y:
   dir file.xxx 2> nul
Ho?c, b?n c th? chuy?n h?ng ?u ra ?n m?t ni, v cc l?i khc.
   dir file.xxx > output.msg 2> output.err
B?n c th? in cc l?i v ?u ra tiu chu?n cho m?t t?p tin b?ng cch s? d?ng cc "& 1" l?nh ? chuy?n h?ng ?u ra cho STDERR to STDOUT v sau g?i ?u ra t? STDOUT ?n m?t t?p tin:
   dir file.xxx 1> output.msg 2>&1

Thu?c tnh

ID c?a bi: 110930 - L?n xem xt sau cng: 17 Thang Tam 2011 - Xem xt l?i: 2.0
p d?ng
  • Microsoft Windows NT Workstation 3.1
  • Microsoft Windows NT Workstation 3.51
  • Microsoft Windows NT Workstation 4.0 Developer Edition
  • Microsoft Windows XP Professional
  • Microsoft Windows Server 2003, Standard Edition (32-bit x86)
  • Microsoft Windows 2000 Professional Edition
T? kha:
kbusage kbmt KB110930 KbMtvi
My d?ch
QUAN TRONG: Bi vi?t ny ?c d?ch b?ng ph?n m?m d?ch my c?a Microsoft ch? khng ph?i do con ng?i d?ch. Microsoft cung c?p cc bi vi?t do con ng?i d?ch v c? cc bi vi?t do my d?ch ? b?n c th? truy c?p vo t?t c? cc bi vi?t trong C s? Ki?n th?c c?a chng ti b?ng ngn ng? c?a b?n. Tuy nhin, bi vi?t do my d?ch khng ph?i lc no c?ng hon h?o. Lo?i bi vi?t ny c th? ch?a cc sai st v? t? v?ng, c php ho?c ng? php, gi?ng nh m?t ng?i n?c ngoi c th? m?c sai st khi ni ngn ng? c?a b?n. Microsoft khng ch?u trch nhi?m v? b?t k? s? thi?u chnh xc, sai st ho?c thi?t h?i no do vi?c d?ch sai n?i dung ho?c do ho?t ?ng s? d?ng c?a khch hng gy ra. Microsoft c?ng th?ng xuyn c?p nh?t ph?n m?m d?ch my ny.
Nh?p chu?t vo y ? xem b?n ti?ng Anh c?a bi vi?t ny:110930

Cung cp Phan hi

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com