以下命令输出一些错误(例如“ 找不到指定的路径” ...)。如何防止此命令显示任何内容?
@echo off
cd C:\test
for /d %%a in (*) do (
echo [test]>"%%a\test.txt"
echo %%a >>"%%a\test.txt"
)
欢迎任何帮助。
谢谢
运行以下命令,它将有助于您了解问题所在。
@echo off
setlocal
echo Starting script
echo Checking if directory exists
if exist "C:\test" (
cd C:\test
echo ... I found the Directory
echo.
echo Running loop
for /d %%a in (*) do (
echo. Processing: "%%a"
echo [test]>"%%a\test.txt"
echo %%a >>"%%a\test.txt"
)
echo ...Loop finished
) else (
echo Whoops the directory "C:\test" does not exist
)
echo.
pause