我有一个批处理脚本,它在运行 W8.1 和 W10 的台式机和笔记本电脑上运行良好已有一段时间了。如果不声明“语法错误”,相同的脚本无法通过最后一行代码
if not exist C:\epic\tablet.txt if not exist C:\epic\laptop.txt (
@set SVPATH="D:\EPIC\Backup\"
) else (
@set SVPATH="C:\EPIC\Backup\"
)
@echo %SVPATH%
if not exist %SVPATH% mkdir %SVPATH%
后面有一堆代码,笔记本电脑和台式机也没有问题,但平板电脑无法通过最后一行。它只是给出以下输出,然后退出脚本:
ECHO is on.
>The syntax of the command is incorrect
>if not exists mkdir
>
看起来它实际上并没有为 SVPATH 设置值,但正如我所说,这在运行 Windows 8.1 和 Windows 10 的台式机和笔记本电脑上都可以正常工作。只有 Surface Pro 4s 有问题,而且不仅仅是一个,这就是我们测试过的所有内容。