如果我想运行命令
md5deep -rb . | find /I ".jpg" | sort > local.md5
我从命令提示符运行它,它显示完全像我input,但是当我把它放在一个.bat文件并运行,这是我看到:
md5deep -rb . | find /I ".jpg" | sort 1>local.md5
它似乎在|之前插入标签 它变成了1> 。 为什么? 首先,我认为这是编码,但文件只是一个简单的ANSI文件。
与@@转动@内部的.bat文件有什么关系?
没什么好担心的。 这正是Windows CMDparsing器在不禁止“trace”输出的情况下输出行的方式:
@echo off
要么
@commandname
我不确定你所指的是@@和@ (除了上面可能的情况)。 我不知道@@有什么特别的地方,除非你把variables名%%与%混淆。
1>指的是在bat文件中标准输出是如何被redirect的。
您有两个通道,一个用于标准输出(1>),一个用于标准输出(2>)。 他们使用1>或2>进行处理,并提供两种不同types的执行反馈。 我有这个列表不同的redirect排列:
command > file Write standard output of command to file command 1> file Write standard output of command to file (same as previous) command 2> file Write standard error of command to file (OS/2 and NT) command > file 2>&1 Write both standard output and standard error of command to file (OS/2 and NT) command >> file Append standard output of command to file command 1>> file Append standard output of command to file (same as previous) command 2>> file Append standard error of command to file (OS/2 and NT) command >> file 2>&1 Append both standard output and standard error of command to file (OS/2 and NT) commandA | commandB Redirect standard output of commandA to standard input of commandB commandA 2>&1 | commandB Redirect standard output and standard error of commandA to standard input of commandB (OS/2 and NT) command < file command gets standard input from file command 2>&1 command's standard error is redirected to standard output (OS/2 and NT) command 1>&2 command's standard output is redirected to standard error (OS/2 and NT)
这是来自Rob van der Woude的Win32脚本优秀网站: http : //www.robvanderwoude.com/redirection.php
抢