簡體   English   中英

將Windows批處理連接到html目錄,該路徑將回顯到文件中。 如何阻止文件名被包含?

[英]Concatenating a directory of html with windows batch, the path is echoed into the file. How do I stop the file name from being included?

我在Windows XP / 7上使用拖放批處理腳本來連接html文件目錄。 我發現命令的一部分被回顯到文件內容上方的最終串聯文件中。 如何停止將shell提示,類型和路徑包括在文件中?

蝙蝠腳本:

set inputdir=%~dpn1
set scriptroot=%~dp0
>"%scriptroot%concat.html" (for /r %inputdir% %%F in (*.html) do type "%%F")

輸出:

C:\Documents and Settings\TMPUSER>type C:\test\test.html"
<html>
...
</html>
C:\Documents and Settings\TMPUSER>type C:\test\test2.html"
<html>
...
</html>

如果您的程序是.bat文件,請在第一行中編寫:

@echo off

默認情況下,顯示命令(和工作文件夾):

C:\folder>echo hi
hi

要禁用此功能,請使用@echo off ,將其啟用,請使用@echo on

希望能有所幫助!

@echo off

將其放在腳本的頂部。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM