
처음에는 그냥 사용했지만 copy
다음과 같은 결과를 얻었습니다.
C:\repos\AutomatedBuildTesting (master -> origin)
(2020-09-18 8:49:01.12) λ copy ".hooks/*" ".git/hooks/*"
commit-msg
The system cannot find the file specified.
0 file(s) copied.
그래서 저는 xcopy
몇 가지를 시도한 후 결국 F
전체 파일 이름을 표시하기 위해 플래그를 포함하는 경우에만 복사된다는 것을 발견했습니다. 누구든지 이것을 설명할 수 있나요?
C:\repos\AutomatedBuildTesting (master -> origin)
(2020-09-18 8:48:32.95) λ xcopy ".hooks/*" ".git/hooks/*"
0 File(s) copied
C:\repos\AutomatedBuildTesting (master -> origin)
(2020-09-18 8:48:58.07) λ xcopy ".hooks/*" ".git/hooks/*" /F
Overwrite C:\repos\AutomatedBuildTesting\.git\hooks\commit-msg (Yes/No/All)? y
C:\repos\AutomatedBuildTesting\.hooks\commit-msg -> C:\repos\AutomatedBuildTesting\.git\hooks\commit-msg
1 File(s) copied
답변1
/
대신에 를 사용하여 경로를 작성합니다 \
. 이를 변경하면 \
작동합니다. 이것이 /f 없이는 작동하지 않고 작동하는 이유를 정확히 말할 수는 없지만 경험을 통해 경로가 대신에 /
다르게 \
처리된다는 것을 알고 있습니다.
/
매개 변수가 포함되면 cmd는 매개 변수가 아닌 경로의 일부임을 알아낼 수 있으므로 명령을 올바르게 처리한다고 가정합니다 .