Editing
Windows xcopy
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
[https://support.microsoft.com/zh-tw/kb/289483 Xcopy 命令] of {{Win}} 技術問題排除 __TOC__ == 錯誤訊息: 參數數目無效 == 輸入命令的例子: <pre> xcopy /y c:\Windows\notepad.exe c:\Program Files\notepad.exe </pre> 原因: 路徑包含空白,請在路徑前面用雙引號框住。 <pre> xcopy /y "c:\Windows\notepad.exe" "c:\Program Files\notepad.exe" </pre> == 錯誤訊息: 分析錯誤 == 輸入命令的例子: <pre> xcopy /y "c:\Windows\notepad.exe" "c:\Program Files\notepad.exe </pre> 原因: 使用雙引號框住路徑時,前後都要加上雙引號。 <pre> xcopy /y "c:\Windows\notepad.exe" "c:\Program Files\notepad.exe" </pre> == 錯誤訊息: 已複製 0 個檔案 == 輸入命令的例子: <pre> xcopy /y "c:/Windows/notepad.exe" "c:\Program Files\notepad.exe </pre> 原因: 來源檔案並不存在,可以搭配使用 [http://www.computerhope.com/dirhlp.htm dir] 命令檢查檔案是否存在,例如 {{kbd | key = <nowiki>dir "c:/Windows/notepad.exe"</nowiki>}} 顯示訊息「找不到檔案」,如果檔案存在,則會顯示檔案修改日期與檔案大小資訊。檔案不存在的可能原因之一是,目錄分隔符號如果使用 [https://zh.wikipedia.org/zh-tw/%E6%96%9C%E7%B7%9A 斜線] {{kbd | key = <nowiki>/</nowiki>}} 會找不到這個檔案。請將目錄分隔符號改成 [https://zh.wikipedia.org/zh-tw/%E5%8F%8D%E6%96%9C%E7%BA%BF 反斜線] {{kbd | key = <nowiki>\</nowiki>}}。 <pre> xcopy /y "c:\Windows\notepad.exe" "c:\Program Files\notepad.exe" </pre> == 錯誤訊息: 是否指定目標檔案,名稱或目標目錄名稱 (F = 檔案,D = 目錄)? == 輸入命令的例子: <pre> xcopy /y "c:\source\abc.gz" "c:\target\def.gz" 出現訊息: def.gz 是否指定目標檔案 名稱或目標目錄名稱 (F = 檔案,D = 目錄)? </pre> 原因: 例子中的 c:\target\ 資料夾並不存在。如果選擇 * (1) F = 檔案,會建立 c:\target 資料夾,並且複製檔案到 c:\target\def.gz * (2) D = 目錄,會建立 c:\target\def.gz\ 資料夾,並且複製檔案到 c:\target\def.gz\abc.gz 解決方式: 參考資料 [http://jdev.tw/blog/4334/xcopy-with-echo xcopy使用技巧 | 簡睿隨筆 | 學習過程的紀錄與備忘] <pre> # 自動輸入 F (檔案) echo F | xcopy /y "c:\source\abc.gz" "c:\target\def.gz" # 自動輸入 D (目錄) echo D | xcopy /y "c:\source\abc.gz" "c:\target\def.gz" </pre> 相關資料 * [http://superuser.com/questions/817586/xcopy-not-creating-source-folder-on-target-drive Xcopy not creating source folder on target drive - Super User] [[Category:Windows]]
Summary:
Please note that all contributions to LemonWiki共筆 are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
LemonWiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Kbd
(
edit
)
Template:Win
(
edit
)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Current events
Recent changes
Random page
Help
Categories
Tools
What links here
Related changes
Special pages
Page information