제 2 인수로 path
을 전달할 때 아래 오류가 발생합니다. 문제는 공간과 같습니다.배치 파일 오류 : "파일이 예기치 않게 발생했습니다."
Files was unexpected at this time
나는 다음과 같은 매개 변수
으로 배치 파일을 실행하고services.cmd 2 "C:\Program Files (x86)\folder\Folder\folder\Bin" corp\acct password
CODE : 당신은 인용 된 문자열 내에서 따옴표를 벗어날 수 없다
@echo off
if "%1" == "" goto PARAMS
if "%2" == "" goto PARAMS
if "%3" == "" goto PARAMS
if "%4" == "" goto PARAMS
sc create "<service name>"%1 binpath= "\%2\xxx.exe\" \"xxx.exe.config\""
rem sc config "<service name>"%1 displayname= "<display name>"%1 obj= %3 password= %4 start= auto description= "Runs the service."
goto END
:PARAMS
echo Usage CreateServices.cmd binfoldername binfolderpath username password
:END
배치 파일의 코드와 전달하는 경로의 값을 제공해주십시오. –