Board logo

标题: [文本处理] 运行BAT修改注册表时提示覆盖 [打印本页]

作者: 玄羽    时间: 2020-12-17 13:19     标题: 运行BAT修改注册表时提示覆盖

运行BAT时提示值srvcomment 已存在,要覆盖吗(Yes/No)?

我是初学求助该怎么添加覆盖或不覆盖的命令?
  1. @echo off
  2. %1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
  3. cd /d "%~dp0"
  4. reg.exe add HKLM\SYSTEM\ControlSet001\Services\LanmanServer\Parameters /v srvcomment /t REG_SZ /d 微软
复制代码

作者: terse    时间: 2020-12-17 13:36

加 /f 看一下
作者: Batcher    时间: 2020-12-17 17:53

回复 1# 玄羽


参考 reg add 命令的 /f 参数
http://bbs.bathome.net/thread-3747-1-1.html
作者: 玄羽    时间: 2020-12-17 19:37

回复 2# terse




    reg.exe add HKLM\SYSTEM\ControlSet001\Services\LanmanServer\Parameters /v srvcomment /t REG_SZ /d 微软 /f
时这样吗?朋友
作者: Batcher    时间: 2020-12-17 21:29

回复 4# 玄羽


    是的,朋友。你试验的时候遇到新问题了吗?




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