在批处理脚本中复制文件?

在批处理脚本中复制文件?

我有一个名为 HUD 的文件夹,它需要转到c:/.../Steam/

找不到我需要怎么做。

这是我的脚本:

@echo off
title[*] Yannick's Gui's installer
:a:
echo [*] Yannick's Gui's installer
echo [*] Welcome %username%
echo [*] %username% Je Kan kiezen uit deeze optie's

ECHO --------------------------------
ECHO 1.Install HUD
ECHO 2.Delete HUD
Echo 2.Close
ECHO --------------------------------


CHOICE /C 123 /M "Optie?:"

IF ERRORLEVEL 5 GOTO ins
IF ERRORLEVEL 4 GOTO del
IF ERRORLEVEL 4 GOTO exit

xcopy "%~d0%~p0hud" C:\Program Files (x86)\Steam\SteamApps\common\Counter-Strike Source\cstrike\custom\ /c /d /e /h /i /k /q /r /s /x /y

:ins
xcopy "%~d0%~p0hud" C:\Program Files (x86)\Steam\SteamApps\common\Counter-Strike Source\cstrike\custom\ /e
pause

:del
del C:\Program Files (x86)\Steam\SteamApps\common\Counter-Strike Source\cstrike\custom\hud
GOTO End

:exit
close

答案1

您需要用引号将包含空格的路径括起来,以便 Windows 知道它是一个单个参数。

所以:

xcopy "%~d0%~p0hud" C:\Program Files (x86)\Steam\SteamApps\common\Counter-Strike Source\cstrike\custom\ /c /d /e /h /i /k /q /r /s /x /y

应该是这样的:

xcopy "%~d0%~p0hud" "C:\Program Files (x86)\Steam\SteamApps\common\Counter-Strike Source\cstrike\custom\" /c /d /e /h /i /k /q /r /s /x /y

相关内容