简体   繁体   English

Windows 批处理文件 - CLS 命令不起作用

[英]Windows Batch File - CLS command not working

Running on Windows 10 Pro 64-bit [Version 10.0.17763.1637];在 Windows 10 Pro 64 位 [版本 10.0.17763.1637] 上运行;

I'm writing a simple batch file to show active processes:我正在编写一个简单的批处理文件来显示活动进程:

cls
echo.
echo Showing all processes similar to %1*
tasklist /FO table /FI "IMAGENAME eq %1*"|more

However, I see that the screen is not being cleared as the script is launched (CLS works fine if I invoke it manually from my Command Line).但是,我看到在脚本启动时屏幕没有被清除(如果我从命令行手动调用它,CLS 工作正常)。

I know it's actually a quite silly issue, I'm just curious to know why that hppens and if there's any workaround.我知道这实际上是一个非常愚蠢的问题,我只是想知道为什么会发生这种情况以及是否有任何解决方法。

Thanks in advance!提前致谢!

Massimo马西莫

i checked your script and cls works perfect(except for it isn't showing active processes) you just need to add @echo off and also validate encoding as ANSI if it isn't,if you want command line without prompt,here it is:我检查了你的脚本并且 cls 工作正常(除了它没有显示活动进程)你只需要添加@echo off并验证编码是否为ANSI ,如果你想要没有提示的命令行,这里是:

@echo off
cls
echo.
echo Showing all processes similar to %1*
tasklist
rem tasklist /FO table /FI "IMAGENAME eq %1*"|more

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM