操作系统:Windows XP
在 cmd shell 中,通过管道输出 fromtasklist /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
:
请注意丢失了多少数据以及光标的奇数位置。这是在上面的 cmd shell 窗口中点击空格后的截图:
这次你看不到光标(我没有在正确的时间点击 prtsc),但它就在该行的正上方--- more --
。