[英]Hide filenames in type command batch file
I'm creating a batch file and the final part of the batch is to concatenate the text from multiple csv files into one. 我正在创建一个批处理文件,该批处理的最后一部分是将多个csv文件中的文本合并为一个。 The csv that is created is correct, however when I run the command it shows the file names on a separate line.
创建的csv是正确的,但是当我运行命令时,它在单独的行上显示了文件名。 Even with echo off it still shows.
即使回声消失,它仍然显示。 When I simply copy and paste the line into a blank txt file and use
@echo off
and that's it.. it still shows the output. 当我简单地将行复制并粘贴到空白txt文件中并使用
@echo off
,仅此而已..它仍显示输出。
type lak-print01.csv lak-print02.csv lak-print03.csv lak-print04.csv or-sdc-print.csv tac-print01.csv tac-print02.csv tuk-print01.csv wa-02print01.csv wa-110print01.csv wa-61print01.csv > MasterPrinterList.csv
The output shown in cmd line is as follows. cmd行中显示的输出如下。 I just want it to perform the type command w/o showing the files.
我只希望它执行不显示文件的类型命令。
lak-print02.csv
lak-print03.csv
lak-print04.csv
or-sdc-print.csv
tac-print01.csv
tac-print02.csv
tuk-print01.csv
wa-02print01.csv
wa-110print01.csv
wa-61print01.csv
Any help? 有什么帮助吗?
Redirect StdErr to nul
by appending 2>nul
. stderr重定向到
nul
通过追加2>nul
。 ( type
outputs filenames into that.) The command you want is this: (
type
文件名输出到其中。)您想要的命令是这样的:
type lak-print01.csv lak-print02.csv lak-print03.csv lak-print04.csv or-sdc-print.csv tac-print01.csv tac-print02.csv tuk-print01.csv wa-02print01.csv wa-110print01.csv wa-61print01.csv > MasterPrinterList.csv 2>nul
type lak-print01.csv lak-print02.csv lak-print03.csv lak-print04.csv or-sdc-print.csv tac-print01.csv tac-print02.csv tuk-print01.csv wa-02print01.csv wa-110print01.csv wa-61print01.csv > MasterPrinterList.csv 2>nul
the file names are printed in error stream so all you need is to add 2>nul
at the end. 文件名将以错误流的形式显示,因此您只需要在末尾添加
2>nul
。
type also accepts wildcards so you can make your line shorter eg 类型还接受通配符,因此您可以缩短行,例如
type lak*.csv or*.csv tac*.csv wa*.csv > MasterPrinterList.csv 2>nul
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.