2

OS:ウィンドウズ XP

cmd シェルでは、からの出力をパイプすると、tasklist /v奇妙なことが起こります。出力をフィルタリングできるようにgrepにパイプしようとしていますが、結果は断続的で一貫性がありません。問題が存在することを確認するより簡単な方法tasklist /vは、単にコマンドを実行することです.吐き出すtasklist /v | more奇妙な(カーソルアップ??)文字がたくさんあるはずです. tasklist /v誰にも洞察がありますか?

からの直接の出力は次のtasklist /vとおりです。

C:\Users\mcintd2\FPF\CVSROOT_working\bin
>tasklist /v

Image Name                   PID Session Name     Session#    Mem Usage Status          User Name                                              CPU Time Window Title
========================= ====== ================ ======== ============ =============== ================================================== ============ ========================================================================
System Idle Process            0 Console                 0         28 K Running         NT AUTHORITY\SYSTEM                                   258:04:49 N/A
System                         4 Console                 0         72 K Running         NT AUTHORITY\SYSTEM                                     1:24:24 N/A
smss.exe                    1448 Console                 0         60 K Running         NT AUTHORITY\SYSTEM                                     0:00:04 N/A
csrss.exe                   1520 Console                 0      3,144 K Running         NT AUTHORITY\SYSTEM                                     0:07:35 N/A
winlogon.exe                1568 Console                 0      9,440 K Running         NT AUTHORITY\SYSTEM                                     0:03:03 N/A
services.exe                1612 Console                 0      3,936 K Running         NT AUTHORITY\SYSTEM                                     0:26:43 N/A
lsass.exe                   1624 Console                 0      3,628 K Running         NT AUTHORITY\SYSTEM                                     0:07:55 N/A
ibmpmsvc.exe                1788 Console                 0        724 K Running         NT AUTHORITY\SYSTEM                                     0:00:00 N/A
nvsvc32.exe                 1820 Console                 0      4,408 K Running         NT AUTHORITY\SYSTEM                                     0:02:37 NVSVCPMMWindowClass
svchost.exe                 1924 Console                 0      2,872 K Running         NT AUTHORITY\SYSTEM                                     0:03:50 N/A
svchost.exe                 1976 Console                 0      2,520 K Running         NT AUTHORITY\NETWORK SERVICE                            0:01:28 N/A
svchost.exe                  404 Console                 0     35,864 K Running         NT AUTHORITY\SYSTEM                                     0:31:27 N/A
Smc.exe                      488 Console                 0      7,612 K Running         NT AUTHORITY\SYSTEM                                     0:32:32 SS
S24EvMon.exe                 752 Console                 0      5,688 K Running         NT AUTHORITY\SYSTEM                                     0:00:02 IWMSWindow
svchost.exe                 1064 Console                 0      1,988 K Running         NT AUTHORITY\NETWORK SERVICE                            0:00:27 N/A
svchost.exe                 1180 Console                 0      1,732 K Running         NT AUTHORITY\LOCAL SERVICE                              0:03:04 N/A
ccSvcHst.exe                1300 Console                 0      3,028 K Running         NT AUTHORITY\SYSTEM                                     0:05:07 N/A
spoolsv.exe                  324 Console                 0      4,676 K Running         NT AUTHORITY\SYSTEM                                     0:01:37 N/A
LVPrcSrv.exe                 384 Console                 0      1,240 K Running         NT AUTHORITY\SYSTEM                                     0:00:20 N/A
svchost.exe                  680 Console                 0      1,908 K Running         NT AUTHORITY\LOCAL SERVICE                              0:00:01 N/A
tphkload.exe                1124 Console                 0        320 K Running         NT AUTHORITY\SYSTEM                                     0:00:00 N/A
TPHKSVC.exe                 1368 Console                 0        384 K Running         NT AUTHORITY\SYSTEM                                     0:00:00 N/A
trcboot.exe                  200 Console                 0        256 K Running         NT AUTHORITY\SYSTEM                                     0:00:00 N/A
PCS_AGNT.EXE                 260 Console                 0        460 K Running         NT AUTHORITY\SYSTEM                                     0:00:01 PCS_AGNT
svchost.exe                 1112 Console                 0        412 K Running         NT AUTHORITY\LOCAL SERVICE                              0:00:00 N/A
CcmExec.exe                 1168 Console                 0     13,272 K Running         NT AUTHORITY\SYSTEM                                     0:19:28 N/A
cvsservice.exe              1888 Console                 0        508 K Running         NT AUTHORITY\SYSTEM                                     0:00:00 N/A
cvslock.exe                 2056 Console                 0        464 K Running         NT AUTHORITY\SYSTEM                                     0:00:00 N/A
DOZESVC.EXE                 2264 Console                 0        260 K Running         NT AUTHORITY\SYSTEM                                     0:00:00 N/A
tpnumlk.exe                 2400 Console                 0        692 K Running         NT AUTHORITY\SYSTEM                                     0:00:00 N/A
EvtEng.exe                  2408 Console                 0      4,080 K Running         NT AUTHORITY\SYSTEM                                     0:00:01 N/A
PresentationFontCache.exe   2720 Console                 0      1,004 K Running         NT AUTHORITY\LOCAL SERVICE                              0:00:00 N/A
unsecapp.exe                2828 Console                 0      1,116 K Running         NT AUTHORITY\SYSTEM                                     0:00:00 N/A
wmiprvse.exe                2888 Console                 0      4,796 K Running         NT AUTHORITY\SYSTEM                                     0:00:06 N/A
miragent.exe                3012 Console                 0      3,624 K Running         NT AUTHORITY\SYSTEM                                     0:00:57 N/A
jqs.exe                     3468 Console                 0      1,412 K Running         NT AUTHORITY\SYSTEM                                     0:13:49 N/A
LMAgent.exe                 3492 Console                 0      5,280 K Running         NT AUTHORITY\SYSTEM                                     0:00:41 N/A
CamMute.exe                 3624 Console                 0        204 K Running         NT AUTHORITY\SYSTEM                                     0:00:00 N/A
micmute.exe                 3640 Console                 0        312 K Running         NT AUTHORITY\SYSTEM                                     0:00:00 N/A
LMS.exe                     3660 Console                 0        848 K Running         NT AUTHORITY\SYSTEM                                     0:01:23 N/A
mdm.exe                     3692 Console                 0      1,912 K Running         NT AUTHORITY\SYSTEM                                     0:00:27 N/A
sqlservr.exe                3708 Console                 0      6,836 K Running         NT AUTHORITY\NETWORK SERVICE                            1:34:58 N/A
NACAgent.exe                3780 Console                 0      1,268 K Running         NT AUTHORITY\SYSTEM                                     0:00:00 N/A
nvPDsvc.exe                 3892 Console                 0        500 K Running         NT AUTHORITY\SYSTEM                                     0:00:19 N/A
PWMDBSVC.exe                3940 Console                 0      1,464 K Running         NT AUTHORITY\SYSTEM                                     0:00:00 N/A
RegSrvc.exe                  640 Console                 0        628 K Running         NT AUTHORITY\SYSTEM                                     0:00:00 N/A
SgeCtl.exe                  1220 Console                 0        792 K Running         NT AUTHORITY\SYSTEM                                     0:00:00 OleMainThreadWndName
sqlbrowser.exe              1912 Console                 0        248 K Running         NT AUTHORITY\NETWORK SERVICE                            0:00:00 N/A
sqlwriter.exe               2072 Console                 0        856 K Running         NT AUTHORITY\SYSTEM                                     0:00:00 N/A
svchost.exe                 2088 Console                 0      2,116 K Running         NT AUTHORITY\SYSTEM                                     0:00:07 N/A
SUService.exe               2100 Console                 0      4,068 K Running         NT AUTHORITY\SYSTEM                                     0:00:00 N/A
Rtvscan.exe                 2168 Console                 0      5,084 K Running         NT AUTHORITY\SYSTEM                                     0:04:32 N/A
tvt_reg_monitor_svc.exe     2248 Console                 0      1,032 K Running         NT AUTHORITY\SYSTEM                                     0:00:17 OleMainThreadWndName
tvtsched.exe                2296 Console                 0      2,376 K Running         NT AUTHORITY\SYSTEM                                     0:00:00 OleMainThreadWndName
wdfmgr.exe                  2212 Console                 0        256 K Running         NT AUTHORITY\LOCAL SERVICE                              0:00:00 N/A
UNS.exe                     2356 Console                 0     14,756 K Running         NT AUTHORITY\SYSTEM                                     0:04:37 N/A
WksCfgSrv.exe               2684 Console                 0      1,508 K Running         NT AUTHORITY\SYSTEM                                     0:01:04 SafeGuard Easy WksCfgSrv Class
Wuser32.exe                 2812 Console                 0        536 K Running         NT AUTHORITY\SYSTEM                                     0:00:23 N/A
ldlcserv.exe                3980 Console                 0        268 K Running         NT AUTHORITY\SYSTEM                                     0:00:00 N/A
wmiprvse.exe                3148 Console                 0      2,272 K Running         NT AUTHORITY\SYSTEM                                     0:00:05 N/A
TPOSDSVC.exe                3420 Console                 0        412 K Running         MYFIRMMASKED\mywinid                                    0:00:14 tphkmgr
tpnumlkd.exe                3440 Console                 0      2,008 K Running         MYFIRMMASKED\mywinid                                    0:00:03 ThinkPad NumLock/CapsLock Indicator
TPONSCR.exe                 3776 Console                 0        688 K Running         MYFIRMMASKED\mywinid                                    0:00:02 tpvolbar
TpScrex.exe                 2860 Console                 0      3,992 K Running         MYFIRMMASKED\mywinid                                    0:00:01 TpUZoom
wmiprvse.exe                 980 Console                 0      8,456 K Running         NT AUTHORITY\NETWORK SERVICE                            0:01:58 N/A
explorer.exe                4112 Console                 0     24,272 K Running         MYFIRMMASKED\mywinid                                    0:21:22 N/A
SmcGui.exe                  4388 Console                 0      7,144 K Running         MYFIRMMASKED\mywinid                                    0:17:52 Network Activity
wmiprvse.exe                4488 Console                 0      3,436 K Running         NT AUTHORITY\SYSTEM                                     0:00:03 N/A
rundll32.exe                1480 Console                 0        364 K Running         MYFIRMMASKED\mywinid                                    0:00:00 BluetoothNotificationAreaIconWindowClass
tpam.exe                    4284 Console                 0        340 K Running         MYFIRMMASKED\mywinid                                    0:00:00 dummy
SynTPEnh.exe                4756 Console                 0      4,000 K Running         MYFIRMMASKED\mywinid                                    0:21:51 Syn Visual Window
ecview.exe                  4804 Console                 0      2,636 K Running         MYFIRMMASKED\mywinid                                    0:00:39 SafeGuardr Easy
scheduler_proxy.exe         5264 Console                 0        580 K Running         MYFIRMMASKED\mywinid                                    0:00:00 N/A
rundll32.exe                5292 Console                 0     11,084 K Running         MYFIRMMASKED\mywinid                                    0:02:33 ATM main window
tpfnf7sp.exe                5928 Console                 0      1,748 K Running         MYFIRMMASKED\mywinid                                    0:00:02 tpfnf7
SynTPLpr.exe                2600 Console                 0        320 K Running         MYFIRMMASKED\mywinid                                    0:00:00 Touchpad driver helper window
TpShocks.exe                4464 Console                 0        424 K Running         MYFIRMMASKED\mywinid                                    0:00:00 N/A
rundll32.exe                4692 Console                 0      5,760 K Running         MYFIRMMASKED\mywinid                                    0:00:03 MediaCenter
GravitixService.exe         3620 Console                 0      6,552 K Running         NT AUTHORITY\SYSTEM                                     0:00:06 N/A
pddm.exe                    3212 Console                 0        360 K Running         MYFIRMMASKED\mywinid                                    0:00:01 Desktop Deployment Manager
ccApp.exe                   3460 Console                 0        536 K Running         MYFIRMMASKED\mywinid                                    0:00:09 CCALERT
ctfmon.exe                  5252 Console                 0      2,780 K Running         MYFIRMMASKED\mywinid                                    0:01:05 N/A
SCHTASK.EXE                 5144 Console                 0      2,888 K Running         MYFIRMMASKED\mywinid                                    0:00:21 ScheduledTask
cmd.exe                     5364 Console                 0      1,276 K Running         MYFIRMMASKED\mywinid                                    0:00:00 cmd
thunderbird.exe            15540 Console                 0      1,576 K Running         MYFIRMMASKED\mywinid                                    0:00:19 MCI command handling window
notepad++.exe               5160 Console                 0     11,960 K Running         MYFIRMMASKED\mywinid                                    0:02:03 C:\Users\mcintd2\FPF\tasklistOut.txt - Notepad++
OUTLOOK.EXE                19324 Console                 0     52,680 K Running         MYFIRMMASKED\mywinid                                    0:25:49 Inbox - Microsoft Outlook
devenv.exe                 28940 Console                 0    154,576 K Running         MYFIRMMASKED\mywinid                                    2:59:07 FPF - Microsoft Visual Studio
wfcrun32.exe               34880 Console                 0      2,612 K Running         MYFIRMMASKED\mywinid                                    0:00:02 Remote Application Runtime
mstsc.exe                  40500 Console                 0     29,568 K Running         MYFIRMMASKED\mywinid                                    0:01:26 N/A
wincvs.exe                 40780 Console                 0     18,228 K Running         MYFIRMMASKED\mywinid                                    0:27:55 wincvs - [C:\Users\mcintd2\FPF\CVSROOT_working\bin\]
firefox.exe                39996 Console                 0    513,708 K Running         MYFIRMMASKED\mywinid                                    0:41:35 windows xp - tasklist output used in pipe is broken - Stack Overflow - M
WinMergeU.exe              37836 Console                 0      9,052 K Running         MYFIRMMASKED\mywinid                                    0:00:03 WinMerge
cmd.exe                    40036 Console                 0      2,868 K Running         MYFIRMMASKED\mywinid                                    0:00:00 dummyWindowTitle
cmd.exe                    40600 Console                 0      3,296 K Running         MYFIRMMASKED\mywinid                                    0:00:00 cmd - tasklist /v
mspdbsrv.exe               42136 Console                 0      3,032 K Running         MYFIRMMASKED\mywinid                                    0:00:00 N/A
cmd.exe                    43364 Console                 0        108 K Running         MYFIRMMASKED\mywinid                                    0:00:00 TD
nsload.exe                 43260 Console                 0     13,672 K Running         MYFIRMMASKED\mywinid                                    0:00:36 N/A
conset.exe                 43592 Console                 0        288 K Running         MYFIRMMASKED\mywinid                                    0:00:00 N/A
nsverctl.exe               44756 Console                 0      5,748 K Running         NT AUTHORITY\SYSTEM                                     0:00:00 N/A
tasklist.exe               43156 Console                 0      5,740 K Running         MYFIRMMASKED\mywinid                                    0:00:00 OleMainThreadWndName

からの出力は次のtasklist /v | moreとおりです。

C:\Users\mcintd2\FPF\CVSROOT_working\bin
>tasklist /v | more

Image Name                   PID Session Name     Session#    Mem Usage Status          User Name                                              CPU Time Window Title
winlogon.exe                1568 Console                 0      9,440 K Running         NT AUTHORITY\SYSTEM                                     0:03:03 N/A
services.exe                1612 Console                 0      3,996 K Running         NT AUTHORITY\SYSTEM                                     0:26:36 N/A
svchost.exe                 1976 Console                 0      2,520 K Running         NT AUTHORITY\NETWORK SERVICE                            0:01:28 N/A
svchost.exe                 1180 Console                 0      1,732 K Running         NT AUTHORITY\LOCAL SERVICE                              0:03:04 N/A
tphkload.exe                1124 Console                 0        320 K Running         NT AUTHORITY\SYSTEM                                     0:00:00 N/A
CcmExec.exe                 1168 Console                 0     13,180 K Running         NT AUTHORITY\SYSTEM                                     0:19:28 N/A
EvtEng.exe                  2408 Console                 0      4,080 K Running         NT AUTHORITY\SYSTEM                                     0:00:01 N/A
jqs.exe                     3468 Console                 0      1,440 K Running         NT AUTHORITY\SYSTEM                                     0:13:45 N/A                                                                     :00:00 N/A
mdm.exe                     3692 Console                 0      1,912 K Running         NT AUTHORITY\SYSTEM                                     0:00:27 N/A
RegSrvc.exe                  640 Console                 0        628 K Running         NT AUTHORITY\SYSTEM                                     0:00:00 N/A
SUService.exe               2100 Console                 0      4,068 K Running         NT AUTHORITY\SYSTEM                                     0:00:00 N/A
UNS.exe                     2356 Console                 0     14,680 K Running         NT AUTHORITY\SYSTEM                                     0:04:35 N/A
TPOSDSVC.exe                3420 Console                 0        412 K Running         MYFIRMMASKED\mywinid                                    0:00:14 tphkmgr
notepad++.exe               5160 Console                 0     11,960 K Running         MYFIRMMASKED\mywinid                                    0:02:03 C:\Users\mcintd2\FPF\tasklistOut.txt - Notepad++
wincvs.exe                 40780 Console                 0     18,228 K Running         MYFIRMMASKED\mywinid                                    0:27:25 wincvs - [C:\Users\mcintd2\FPF\CVSROOT_working\bin\]
mspdbsrv.exe               42136 Console                 0      3,032 K Running         MYFIRMMASKED\mywinid                                    0:00:00 N/A
tasklist.exe               41524 Console                 0      5,748 K Running         MYFIRMMASKED\mywinid                                    0:00:00 OleMainThreadWndName
more.com                   44544 Console                 0      1,604 K Running         MYFIRMMASKED\mywinid                                    0:00:00 N/A
nsverctl.exe               44756 Console                 0      5,748 K Running         NT AUTHORITY\SYSTEM                                     0:00:00 N/A
tpfnf7sp.exe                5928 Console                 0      1,748 K Running         MYFIRMMASKED\mywinid                                    0:00:02 tpfnf7
C:\Users\mcintd2\FPF\CVSROOT_working\bin                 0        320 K Running         MYFIRMMASKED\mywinid                                    0:00:00 Touchpad driver helper window
>pShocks.exe                4464 Console                 0        424 K Running         MYFIRMMASKED\mywinid                                    0:00:00 N/A
rundll32.exe                4692 Console                 0      5,760 K Running         MYFIRMMASKED\mywinid                                    0:00:03 MediaCenter
gravitixService.exe         3620 Console                 0      6,552 K Running         NT AUTHORITY\SYSTEM                                     0:00:06 N/A
pddm.exe                    3212 Console                 0        360 K Running         MYFIRMMASKED\mywinid                                    0:00:01 Desktop Deployment Manager
ccApp.exe                   3460 Console                 0        432 K Running         MYFIRMMASKED\mywinid                                    0:00:09 CCALERT
ctfmon.exe                  5252 Console                 0      2,780 K Running         MYFIRMMASKED\mywinid                                    0:01:03 N/A
SCHTASK.EXE                 5144 Console                 0      2,888 K Running         MYFIRMMASKED\mywinid                                    0:00:21 ScheduledTask
cmd.exe                     5364 Console                 0      1,276 K Running         MYFIRMMASKED\mywinid                                    0:00:00 cmd
thunderbird.exe            15540 Console                 0      1,576 K Running         MYFIRMMASKED\mywinid                                    0:00:19 MCI command handling window

出力の半分が欠落しており、コマンド プロンプトがリストの途中に表示されることに注意してください。呼び出すtasklist /v | moreと、毎回異なる奇妙な動作が発生します。

による最初の一時停止のスクリーンショットは次のmoreとおりです。

コマンドウィンドウ

不足しているデータの量と、カーソルの位置が奇妙であることに注意してください。上記のコマンド シェル ウィンドウでスペースを押した後のスクリーンショットを次に示します。

再びコマンドウィンドウ

今回はカーソルが見えませんが (prtsc を適切なタイミングで押していませんでした)、行のすぐ上の--- more --行にあります。

4

2 に答える 2

1

タスクリストがstderrにガベージを吐き出し、それが後のパイプステージ(の表示)で問題を引き起こすことが判明しました。

これを確認するには、コンソールフォントをLucida(プロパティ内)に変更し、コードページを437(chcp 437)に変更して再実行しますtasklist

使用を取り除くためにtasklist 2>nul | more(またはgrep、明らかに)(表示のみに影響するかどうかを判断できる限り、tasklist |grep whatever >result.txt一貫性のある/適切な結果も得られるはずです。

あなたと同じバージョン(5.1.2600 SP3)でテストされています。迷惑な...私にはバグのように見えます。

于 2012-08-02T01:13:10.740 に答える
0

パイプを通すmoreと、より多くの実際の行が得られます

C:\Steven\Desktop\etc>tasklist -v | C:\cygwin\bin\wc
     39     448    8780

C:\Steven\Desktop\etc>tasklist -v | more | C:\cygwin\bin\wc
     41     458    9013
于 2012-08-01T19:46:30.947 に答える