是否可以在set /P命令后创建换行符?我希望用户能够键入新的(空白)行而不是现有提示旁边的行.例如:
set /P test=type now
echo %test%
Run Code Online (Sandbox Code Playgroud)
此代码只是让用户在提示旁边输入.
即使 if 匹配(并且也被处理),批处理脚本也会处理 else 语句。为什么是这样?
set getprocesslistlocal=wmic process get name,processid
echo Type the name of the remote machine to view processes of (or type local for local machine), and press Enter.
set /P remotemachine=
if %remotemachine%==local (
%getprocesslistlocal%
) else (
echo Type the user name to access %remotemachine% with, then press Enter.
set /P remoteuser=
echo Type the password for %remoteuser% on %remotemachine%, then press Enter. (Will be displayed in plaintext)
set /P remotepassword=
set getprocesslistremote=wmic /node %remotemachine% /user:%remoteuser% …Run Code Online (Sandbox Code Playgroud)