Board logo

标题: [系统相关] 批处理怎样根据用户输入编辑echo出来的结果 [打印本页]

作者: cd309420    时间: 2009-4-23 13:39     标题: 批处理怎样根据用户输入编辑echo出来的结果

  1. set pcname=%TEMP%\pcname.txt
  2. echo sNewName = ComputerName >%pcname%
  3. echo sNewName="计算机名" >>%pcname%
  4. echo Set oShell = CreateObject ("WSCript.shell") >>%pcname%
  5. echo sCCS = "HKLM\SYSTEM\CurrentControlSet\" >>%pcname%
  6. echo sTcpipParamsRegPath = sCCS & "Services\Tcpip\Parameters\" >>%pcname%
  7. echo sCompNameRegPath = sCCS & "Control\ComputerName\" >>%pcname%
  8. echo With oShell >>%pcname%
  9. echo .RegDelete sTcpipParamsRegPath & "Hostname" >>%pcname%
  10. echo .RegDelete sTcpipParamsRegPath & "NV Hostname" >>%pcname%
  11. echo .RegWrite sCompNameRegPath & "ComputerName\ComputerName", sNewName >>%pcname%
  12. echo .RegWrite sCompNameRegPath & "ActiveComputerName\ComputerName", sNewName >>%pcname%
  13. echo .RegWrite sTcpipParamsRegPath & "Hostname", sNewName >>%pcname%
  14. echo .RegWrite sTcpipParamsRegPath & "NV Hostname", sNewName >>%pcname%
  15. echo End With >>%pcname%
  16. echo Msgbox "计算机名修改成功!"& vbcr &"重新启动计算机后生效!" >>%pcname%
复制代码


需更改的地方 echo sNewName="计算机名" >>%pcname%

         “在批处理窗口输入我想更改的计算机名”如:“客户端1”echo出来的结果是:  sNewName="客户端1"
作者: zqz0012005    时间: 2009-4-23 14:41

您老是这个意思?
  1. set /p sNewName=输入我想更改的计算机名:
复制代码





欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2