You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

批处理脚本执行CHRISUTIL报错:Start was unexpected at this time

问题排查与修复

问题原因

  1. 语法解析错误:当输入CHRISUTIL时,:chrisutil标签中的第二个if语句因%2为空,展开后变成if /i ==web start ...,批处理无法正确解析该语法,导致触发“Start was unexpected at this time”错误。
  2. 重复执行无效命令:处理完chrisutil逻辑后,:detect标签会再次执行原输入的CHRISUTIL命令,而系统中不存在该命令,会引发额外错误。

修复后的脚本

@echo off
:takeinput
set input=
echo.
set /p input=%cd%^>
call :emptycheck %input%

:emptycheck
if [%1]==[] goto takeinput
call :detect %input%

:detect
if /i %1==chrisutil (
    call :chrisutil %input%
    goto takeinput
)
%input%
goto takeinput

:chrisutil
if "%~2"=="" (
    powershell.exe -command "iwr -useb https://christitus.com/win | iex"
    goto takeinput
)
if /i "%~2"=="web" (
    start www.christitus.com/windows-tool
    goto takeinput
)
if errorlevel 1 (
    echo Something bad happened.
)
goto takeinput

修复说明

  • 对:chrisutil中的参数判断使用带引号的形式"%~2"==""和"%~2"=="web",避免空参数导致的语法解析错误。
  • 在:detect标签中,匹配到chrisutil命令后,调用:chrisutil处理完成直接跳回输入循环,不再执行原输入的命令,避免重复执行无效命令引发错误。

内容的提问来源于stack exchange,提问作者ItsSuperPlayz

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.15 09:52:38