windows - 批处理文件复制不起作用,告诉我找不到指定的文件

标签 windows batch-file cmd rename xcopy

<分区>

所以基本上我有这个批处理文件,当人们下载程序时它将成为安装程序。但即使文件和所有内容都已经存在,它仍然告诉我“找不到指定的文件 - 复制了 0 个文件”。

这是代码

@echo off
@echo copyright Maximillian Kasharkov, 2013
@echo Installation of Chrome-d will proceed. Do you want to continue?
pause
@echo This version of Chrome-d includes many improvements such as:
@echo Browsing speed increased by 5%
@echo Better security of sessions
@echo Slightly more lightweight
@echo Takes up lesser resources, better for older computers
@echo More fun :D
@echo Please wait while Chrome-d installs on your computer
@echo copying for 64 bit possibilities
@echo copying chrome-d_x64.exe
@echo ...
xcopy "%~dp0\chrome.exe" "C:\Program Files (x86)\Google\Chrome\Application" /c /q /i /e /y
xcopy "%~dp0\chrome1.exe" "C:\Program Files (x86)\Google\Chrome\Application" /c /q /i /e /y
xcopy "%~dp0\start.bat" "C:\Program Files (x86)\Google\Chrome\Application" /c /q /i /e /y
@echo copying LAYERS directory
@echo ...
xcopy "%~dp0\LAYERS" "C:\Program Files (x86)\Google\Chrome\Application" /c /q /i /e /y
@echo copying Library directory
@echo ...
xcopy "%~dp0\Library" "C:\Program Files (x86)\Google\Chrome\Application" /c /q /i /e /y
@echo creating shortcut on desktop
@echo ...
@echo d | xcopy "%~dp0\chrome-d 64.lnk" "%userprofile%\desktop" /c /q /i /e /y
@echo removing ghost copies of LAYERS and Library folders on desktop, sorry for the bug
@echo ...
rmdir /s /q "%USERPROFILE%\Desktop\LAYERS"
rmdir /s /q "%USERPROFILE%\Desktop\Library"
@echo copying for 32 bit possibilites
@echo copying chrome.exe
@echo ...
xcopy "%~dp0\chrome.exe" "C:\Program Files\Google\Chrome\Application" /c /q /i /e /y
@echo copying LAYERS directory
@echo ...
mkdir C:\Program Files\Google\Chrome\Application\LAYERS
xcopy "%~dp0\LAYERS" "C:\Program Files\Google\Chrome\Application" /c /q /i /e /y
@echo copying Library directory
@echo ...
mkdir C:\Program Files\Google\Chrome\Application\Library
xcopy "%~dp0\Library" "C:\Program Files\Google\Chrome\Application" /c /q /i /e /y
@echo creating shortcut on desktop
@echo ...
xcopy "%~dp0\chrome-d.lnk" "%userprofile%\desktop" /c /q /i /e /y
xcopy "%~dp0\chrome-d 64.lnk" "%userprofile%\desktop" /c /q /i /e /y
@echo removing ghost copies of LAYERS and Library folders on desktop, sorry for the bug
@echo ...
rmdir /s /q "%USERPROFILE%\Desktop\LAYERS"
rmdir /s /q "%USERPROFILE%\Desktop\Library"
pause
@echo Chrome-d is done :)
@echo  
@echo  
@echo To launch the new and more awesome version of chrome-d, just click the shortcut on your desktop.
@echo Please remember to manually add the shortcut to the windows taskbar (the panel at the top or bottom of your computer)
@echo  
@echo Thank you for trying out chrome-d! :D
@echo Have a nice day ahead!
pause

我不明白代码有什么问题,文件和文件夹都已经在那里了。 LAYERS 和 Library 是同一文件夹中的一个目录,其他所有内容都在那里,不在任何子文件夹中。

有人可以帮忙吗?

我所指的文件夹的屏幕截图:http://postimg.org/image/pnqykv7tl/

注意:64 位(前半部分)不应该工作,因为我在 32 位 com 上测试,但在 32 位 com 上它也不起作用

最佳答案

xcopy "%~dp0\chrome.exe"

xcopy 不喜欢文件名前的双反斜杠 \\。全部改变

xcopy "%~dp0\"

xcopy "%~dp0"
rem example: xcopy "%~dp0chrome.exe"

具有讽刺意味的是,如果它出现在路径名中,这不是问题,例如。 xcopy "%~dp0\Library\chrome.exe"

关于windows - 批处理文件复制不起作用,告诉我找不到指定的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17258044/

相关文章:

batch-file - 使用批处理文件按键盘键

python - Windows Defender 从我的 pyinstaller exe 提醒用户

c++ - 更改整个控制台背景颜色 (Win32 C++)

windows - 我如何自动替换网络服务器上的文件,以便它的最新版本持续可用?

windows - 使用 Windows 命令 shell 创建多个文件

java - 如何使用参数化构造函数运行 junit

python - 通过python程序访问网络文件夹

java - ProcessBuilder 向命令行添加额外的引号

xml - 批量更新xml文件

django - 使用BAT文件一键启动Django项目