@echo off
title 参数问题
if not "%1"=="" echo %1
if "%1"=="" echo 无参数
pause
[ Last edited by chishingchan on 2008-4-14 at 02:04 PM ]
作者: vkill 时间: 2007-12-13 20:13
pause
作者: chishingchan 时间: 2007-12-13 20:22
Originally posted by vkill at 2007-12-13 08:13 PM:
pause
我拖的是 kis7.sch.msi 文件,加了暂停指令还是一闪而过!
情况:一闪而过
@echo off
title 参数问题
if "%1"=="" echo 无参数 else echo %1
pause
情况:显示所拖的文件名称
@echo off
title 参数问题
echo %1
pause
[ Last edited by chishingchan on 2007-12-13 at 08:30 PM ]
作者: zh159 时间: 2007-12-13 21:12
@echo off
title 参数问题
if "%1"=="" (echo 无参数) else echo %1
pause
作者: chishingchan 时间: 2007-12-13 22:17
Originally posted by zh159 at 2007-12-13 09:12 PM:
@echo off
title 参数问题
if "%1"=="" (echo 无参数) else echo %1
pause
请问你自己试过没有啊?
你的方案还不是一闪而过?!
作者: ILoveDosoo1 时间: 2007-12-13 22:45
@echo off
title 参数问题
if "%1"=="" echo 无参数
:a
if not "%1"=="" echo %1 & goto b
goto a
:b
pause
不知道可以吗?
作者: chishingchan 时间: 2007-12-14 00:31
Originally posted by ILoveDosoo1 at 2007-12-13 10:45 PM:
@echo off
title 参数问题
if "%1"=="" echo 无参数
:a
if not "%1"=="" echo %1 & goto b
goto a
:b
pause
不知道可以吗?
你和4楼的是一伙的都不行:拖个文件下去试试!
作者: balinger 时间: 2007-12-14 21:37
@echo off
title 参数问题
if not %1*==* echo %1
if %1*==* echo 无参数
pause
作者: chishingchan 时间: 2007-12-14 23:56
Originally posted by balinger at 2007-12-14 09:37 PM:
@echo off
title 参数问题
if not %1*==* echo %1
if %1*==* echo 无参数
pause
不错,初步测试正常。整合到我的批处理里再试试。谢谢!
作者: chishingchan 时间: 2007-12-15 00:21
@echo off
title 参数问题
if not %1*==* set file=%1
echo %file%
pause
通过!
[ Last edited by chishingchan on 2007-12-15 at 12:24 AM ]
作者: hxwxyz 时间: 2007-12-15 12:07
学习了 请问下 怎么加个*就可以了
作者: Climbing 时间: 2007-12-15 14:07
跟*不*的没有关系吧。在我的测试中,下面的_t1和_t2均正常:
@echo off
title 参数问题
goto :_t2
:_t1
if not "%1"=="" echo _t1:%1
if "%1"=="" echo _t1:无参数
pause
goto :eof
:_t2
if "%1"=="" (echo _t2:无参数) else (echo _t2:%1)
pause
作者: chishingchan 时间: 2008-4-14 14:03 标题: 总结:
12 楼的代码是不符合要求的!
@echo off
title 测试时直接运行或拖曳文件到此批处理,有显示:正确;无显示:错误
if not %1*==* set file=%1
if %1*==* set file=Null
echo %file%
pause