从批处理文件中 XCOPY Vista 上的主机文件

发布于 2024-07-10 08:50:31 字数 270 浏览 7 评论 0原文

我需要一个命令来替换我的机器上的主机文件。 看起来很简单,但我无法获得与 xcopy 一起使用的命令。 该命令有任何明显的缺陷吗?

luaexec -w -f "XCOPY" "%ScriptPath%/ModifiedHosts/vista/hosts" "%windir%/system32/drivers/etc/hosts" /H

/R 标志似乎没有帮助,如果我删除除开头和结尾引号之外的所有引号,我得到的错误是“错误:ShellExecuteEx 失败 0x2”

I need a command to replace the hosts file on my machine. Seems pretty straight forward but I cannot get the command to work with xcopy. Any obvious flaws in the command?

luaexec -w -f "XCOPY" "%ScriptPath%/ModifiedHosts/vista/hosts"
"%windir%/system32/drivers/etc/hosts" /H

The /R flag does not seem to help and the error I get is "Error: ShellExecuteEx failed 0x2" if I remove all quotes but the beginning and end quotes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

提赋 2024-07-17 08:50:31

您收到任何错误吗?

试试这个:

luaexec -w -f "XCOPY %ScriptPath%/ModifiedHosts/vista/hosts %windir%/system32/drivers/etc/hosts" /H

另外,您可以尝试 robocopy。

Did you get any error?

Try this:

luaexec -w -f "XCOPY %ScriptPath%/ModifiedHosts/vista/hosts %windir%/system32/drivers/etc/hosts" /H

Also, you can try robocopy.

唠甜嗑 2024-07-17 08:50:31

主机文件是否被写保护? 可能是..在命令行中添加 /R

is the hosts file write protected? it probably is.. add a /R to your commandline

说谎友 2024-07-17 08:50:31

在 Vista 上,您需要以管理员身份运行才能更改主机文件。

参考< /a>

On Vista, you need to run as Administrator to change the hosts file.

Reference

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文