1

如何使用以下变量

SET DESKTOP_PATH = C:\Users\Kostas\Desktop\ToMobile
SET MOBILE_PATH = H:\koinoxrista

在 xcopy 命令中?

我使用下面的代码

xcopy %DESKTOP_PATH%\*.txt %MOBILE_PATH% /v

但我收到

file not found - *.txt

这是我的代码

    @echo off

SET DESKTOP_PATH = C:\Users\Kostas\Desktop\ToMobile
SET MOBILE_PATH = H:\koinoxrista

chdir \
chdir /d h:\koinoxrista

SET "FLAG="

IF EXIST Bill.txt SET FLAG=1
IF EXIST BillPayments.txt SET FLAG=1
IF EXIST Collector.txt SET FLAG=1
IF EXIST CompanyInfo.txt  SET FLAG=1
IF EXIST Expense.txt  SET FLAG=1
IF EXIST ExpensePayments.txt  SET FLAG=1
IF EXIST FlatComments.txt  SET FLAG=1
IF EXIST FlatMetric.txt  SET FLAG=1

IF DEFINED FLAG (ECHO Error!) ELSE (xcopy %DESKTOP_PATH%\*.txt %MOBILE_PATH% /v /w)

pause
4

1 回答 1

3

删除 SET 命令中的空格

SET DESKTOP_PATH=C:\Users\Kostas\Desktop\ToMobile
SET MOBILE_PATH=H:\koinoxrista
于 2012-10-08T10:57:50.883 回答