gpt4 book ai didi

batch-file - 批处理文件错误 : "Files was unexpected at this time."

转载 作者:行者123 更新时间:2023-12-03 10:05:32 27 4
gpt4 key购买 nike

当我将 path 作为我的第二个参数传递时,出现以下错误。看起来问题出在空间上。

此时文件是意外的

我正在执行带有以下参数的批处理文件

services.cmd 2 "C:\Program Files (x86)\folder\Folder\folder\Bin"corp\acct 密码

代码:

@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

最佳答案

您不能在带引号的字符串中转义引号。使用 %~2 去除参数中不需要的引号。

尝试以下操作:

sc create "<service name>%~1" binpath= "%~2\xxx.exe" "xxx.exe.config"

关于batch-file - 批处理文件错误 : "Files was unexpected at this time.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21602348/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com