當我通過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
您能否提供批處理文件的代碼和您傳遞的路徑的值? –