我问了几个人问题是什么,并且两次没有解决方案就走了。我以前没有太多玩过批处理,所以这可能是一个简单的错误。该代码目前应该给出使用 wmic 的进程列表。最后,我想设置它来杀死进程(我应该可以很容易地做到这一点),但我必须首先克服这个障碍。
@echo off
set getprocesslistlocal=wmic process get name,processid
set /P remotemachinecheck=Type the name of the remote machine to view processes of (or type local for local machine), and press Enter.
if %remotemachinecheck%==local
(
%getprocesslistlocal%
) else (
set remotemachine=%remotemachinecheck%
set /P remoteuser=Type the user name to access %remotemachine% with, then press Enter.
set /P remotepassword=[Type the password for %remoteuser% on %remotemachine%, then press Enter. Watch your back, it won't be hidden!
set getprocesslistremote=wmic /node %remotemachine% /user:%remoteuser% /password:%remotepass% process get name,processid
%getprocesslistremote%
)
echo End of list. Press any key to choose process to kill.
@echo off
pause>null