【发布时间】:2014-11-15 00:36:12
【问题描述】:
@echo off
title LocalTransmit Messaging Service Version 1.0
color f0
:startup
start run.cmd
set /P locationVal="Enter where you are (home or school):"
if "%locationVal%"=="home" (
set place=C:\Users\Andrew\Data\Chat\chatroom.chatfile
echo %computername% has joined the chatroom! >> %place%
goto message
)
if "%locationVal%"=="school" (
set place=\\HS-LAB-12\Users\student\Data\Chat\chatroom.chatfile
echo %computername% has joined the chatroom! >> %place%
goto message
)
goto error
所以上面的代码是一个短消息程序的开始代码。我试图让它更加用户友好,但突然上面的代码导致命令提示符窗口关闭,并导致在窗口关闭之前提示符下方短暂出现“命令的语法不正确”。我无法弄清楚我的语法有什么问题。非常感谢任何帮助。
附: .chatfile 是由该程序的先前版本生成的,其作用类似于普通文本文件。
【问题讨论】:
标签: batch-file syntax syntax-error