我正在尝试编写一个Windows批处理脚本来为我做一些工作。这是代码:
for($i =2;($data = fgetcsv($handle, 10000, ",")) !== FALSE; $i++)
第二个和第三个答案总是空的,当我从提示中删除引号时它会指责“?”字符。代码有什么问题?
感谢。
答案 0 :(得分:3)
这是一种废话,但无论如何,由于“延迟扩展”,我将代码修改为:
@echo off
Setlocal EnableDelayedExpansion
cls
set /P AA="Is this information correct (Y/[N]) ? "
if /I "%AA%" == "Y" (
echo Setting up %DATE% %TIME% ...
echo Copying stuff to the places ...
set /P BB="Overwrite (Y/[N]) ? "
if /I "!BB!" == "Y" (
echo Executing xxx ...
) else echo NOPE1 [!BB!]
set /P CC="Overwrite (Y/[N]) ? "
if /I "!CC!" == "Y" (
echo Executing xxx ...
) else echo NOPE2 [!CC!]
echo All set !
) else echo Setup aborted [%AA%] !
pause
它正在发挥作用!谢谢npocmaka和Stephan