标题: [系统相关] 批处理怎样根据用户输入编辑echo出来的结果 [打印本页]
作者: cd309420 时间: 2009-4-23 13:39 标题: 批处理怎样根据用户输入编辑echo出来的结果
- set pcname=%TEMP%\pcname.txt
- echo sNewName = ComputerName >%pcname%
- echo sNewName="计算机名" >>%pcname%
-
- echo Set oShell = CreateObject ("WSCript.shell") >>%pcname%
-
- echo sCCS = "HKLM\SYSTEM\CurrentControlSet\" >>%pcname%
- echo sTcpipParamsRegPath = sCCS & "Services\Tcpip\Parameters\" >>%pcname%
- echo sCompNameRegPath = sCCS & "Control\ComputerName\" >>%pcname%
-
- echo With oShell >>%pcname%
- echo .RegDelete sTcpipParamsRegPath & "Hostname" >>%pcname%
- echo .RegDelete sTcpipParamsRegPath & "NV Hostname" >>%pcname%
-
- echo .RegWrite sCompNameRegPath & "ComputerName\ComputerName", sNewName >>%pcname%
- echo .RegWrite sCompNameRegPath & "ActiveComputerName\ComputerName", sNewName >>%pcname%
- echo .RegWrite sTcpipParamsRegPath & "Hostname", sNewName >>%pcname%
- echo .RegWrite sTcpipParamsRegPath & "NV Hostname", sNewName >>%pcname%
- echo End With >>%pcname%
- echo Msgbox "计算机名修改成功!"& vbcr &"重新启动计算机后生效!" >>%pcname%
复制代码
需更改的地方 echo sNewName="计算机名" >>%pcname%
“在批处理窗口输入我想更改的计算机名”如:“客户端1”echo出来的结果是: sNewName="客户端1"
作者: zqz0012005 时间: 2009-4-23 14:41
您老是这个意思?- set /p sNewName=输入我想更改的计算机名:
复制代码
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |