当我运行批处理文件时,出现系统找不到指定的文件。

huangapple go评论108阅读模式
英文:

When I run batch file, I get the system cannot find the file specified

问题

我需要修补一些东西,并且通常在Windows上对旧文件进行存档以修补它。

我正在使用复制语句来执行此操作:copy /y file.template "..\..\server\Process\"

当文件到达这一点时,它要么输出访问被拒绝,要么当我以管理员身份运行它时,会显示:系统找不到指定的文件。

我不确定问题是什么?也许我运行批处理文件的方式不对,或者可能是这个语句有问题。

操作系统:Windows 8

谢谢

我已经尝试以管理员身份运行文件。我将复制行分开运行,但仍然无法访问或找不到指定的文件。

英文:

I need to patch something and to fix the patch we usually archive the old file on windows and replace it with the file with a patch.

I am using copy statement to do this: copy /y file.template "..\..\server\Process\"

When the file gets to this point it is outputting either access denied, or when I run it as admin I get: the system cannot find the file specified.

I am not sure what the problem is? I might be running the batch file wrong or maybe it is the statement.

Operating system: windows 8
Thanks

I have tried running the file as admin. I have taken the copy line and ran it separately, I keep getting access denied or the system cannot find the file specified.

答案1

得分: 0

我以管理员身份运行了PowerShell,然后进入了那个文件夹,然后像下面这样运行了批处理文件,它成功运行了。

cd batchFile/patch
./file.bat

我无法在命令提示符上运行它,但我在这里找到了一些信息。

英文:

I ran powershell as admin and cd into that folder then just ran the batch file like below and it worked.

cd batchFile/patch
./file.bat

I couldn't figure out how to run it on command prompt but I've found something here

huangapple
  • 本文由 发表于 2023年6月22日 02:55:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/76526329.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定