批量使用变量来执行具有不同输入的命令

Use variables in batch to perform a command with varying inputs

如何使变量在批处理命令中起作用?

我想执行以下操作:

@echo off  
set /p Name=Choose your name:  
set /p PW=Choose your password:  
Net user %Name% %PW% /add  

我刚刚得到 "System Error 5"

 Right-click on program icon (file.batch).
 Choose Run As Administrator.

 If you see a User Account Control prompt, accept it.

运行 以管理员身份 它将起作用