You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
@ ECHO off
: : 关闭命令行默认的命令回显(不显示执行的命令本身)
GOTO start
: : 跳转到:start标签处开始执行, 跳过中间的:find_dp0函数定义
: find_dp0
: : 定义一个函数,用于获取当前脚本所在的目录路径
SET dp0 = %~dp0
: : %~dp0 是批处理的特殊变量,获取当前脚本的绝对目录路径(包含末尾的反斜杠)
EXIT /b
: : 退出当前函数,返回上一级调用处
: start
: : 程序开始执行的入口点
SETLOCAL
: : 开启局部环境变量模式,确保后续变量修改不会影响全局环境
CALL : find_dp0
: : 调用:find_dp0函数, 获取当前脚本目录并赋值给dp0变量
: : 检查当前脚本目录下是否存在node.exe可执行文件
IF EXIST " %dp0% \node.exe " (
: : 如果存在, 将_node变量设为当前目录下的node.exe路径
SET " _prog= %dp0% \node.exe "
) ELSE (
: : 如果不存在, 使用系统全局的node命令
SET " _prog=node "
: : 修改PATHEXT环境变量, 移除.JS扩展名( 避免将node命令误认为.js文件)
SET PATHEXT = %PATHEXT:;.JS;=;%
)
: : 结束局部环境变量模式, 并执行node命令启动acorn
: : title %COMSPEC% 用于设置命令行窗口标题(兼容部分环境)
: : "%_prog%" 是node的路径( 本地或全局)
: : "%dp0%\..\acorn\bin\acorn" 是acorn入口脚本的路径( 相对当前脚本)
: : %* 传递所有命令行参数给acorn
endLocal & goto #_undefined_# 2 > NUL || title %COMSPEC% & " %_prog% " " %dp0% \..\acorn\bin\acorn " %*