标题: [已解决]批处理有半法令单个命令跨行吗?
[打印本页]
作者: ec2049
时间: 2009-5-4 05:53
标题: [已解决]批处理有半法令单个命令跨行吗?
Bash的.sh脚本可以用括号让命令跨行
$SED -n -e '1,100{
/I /{
s,.*,import,
p
q
}
}
而cmd里目前只想到可以使用变量替代:
@echo off
FOR /f %%z IN ('type media-ext.txt') DO (SET FileExt=%%z)
SET arga=-oac lavc -af channels=1 -srate 8000
SET argv=-ovc lavc -vf scale -zoom -xy 320 -ofps 10
SET argf=-of lavf -lavcopts vcodec=h263p:acodec=libamr_nb:abitrate=12200:vbitrate=128000
FOR /f "delims=" %%i IN ('dir /b/a-d %FileExt%') DO (
mencoder.exe %arga% %argv% %argf% "%%~nxi" -o "Z%%~ni.3gp"
)
pause
Windows的CMD批处理有半法把单个命令跨行吗?
[
Last edited by ec2049 on 2009-5-4 at 07:48 ]
作者: ec2049
时间: 2009-5-4 06:00
如果连变量都不用,命令就会长到这种程度:
mencoder.exe -oac lavc -af channels=1 -srate 8000 -ovc lavc -vf scale -zoom -xy 320 -ofps 10 -of lavf -lavcopts vcodec=h263p:acodec=libamr_nb:abitrate=12200:vbitrate=128000 "%%~nxi" -o "Z%%~ni.3gp"
导致看不清选项……
作者: freeants001
时间: 2009-5-4 06:19
dir ^
/a ^
/b %windir%&echo 中国^
DOS^
联盟
作者: yishanju
时间: 2009-5-4 06:21
还真没见过。。。
作者: ec2049
时间: 2009-5-4 07:47
感谢freeants001的迅速解答!原来^和@一样可以作用于命令。
不过之前查了半天ntcmds.chm也没找到啊。微软只提到“脱字符”一种用法而已。