Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/svn/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 从dir命令中排除文件列表_Windows_Batch File_Command Line_Directory_Findstr - Fatal编程技术网

Windows 从dir命令中排除文件列表

Windows 从dir命令中排除文件列表,windows,batch-file,command-line,directory,findstr,Windows,Batch File,Command Line,Directory,Findstr,我需要使用dir创建一个文件列表,其中不包括.txt文件中列出的某些文件。我尝试过这样做,但似乎不起作用: dir %ProjectDir%\*.ts /b /s | findstr /v /f:listFiles.txt > Files.txt 编辑:这类操作有效,但只有一个文件名被添加到文本文件中 for /f "tokens=* delims= " %%a in ('dir %ProjectDir%TypeScript\*.ts /b /s') do ( find /i "%

我需要使用dir创建一个文件列表,其中不包括.txt文件中列出的某些文件。我尝试过这样做,但似乎不起作用:

dir %ProjectDir%\*.ts /b /s | findstr /v /f:listFiles.txt > Files.txt
编辑:这类操作有效,但只有一个文件名被添加到文本文件中

for /f "tokens=* delims= " %%a in ('dir %ProjectDir%TypeScript\*.ts /b /s') 
do (
  find /i "%%a" < strictFiles.txt > nul || echo.%%a > tsFiles.txt
)
for/f“tokens=*delims=“%%a in('dir%ProjectDir%TypeScript\*.ts/b/s'))
做(
查找/i“%%a”nul | | echo.%%a>tsFiles.txt
)

尝试使用正确的选项
/f
提供文件列表,供
findstr
检查字符串。如果您使用
/g
,则它将读取您的文件并与文件中的文本进行匹配。这似乎也不起作用。我刚得到一个空白的文本文件。请给我们看一下您的
listfiles.txt
示例,然后尝试使用正确的选项
/f
提供文件列表,供
findstr
检查字符串。如果您使用
/g
,则它将读取您的文件并与文件中的文本进行匹配。这似乎也不起作用。我刚得到一个空白文本文件。请给我们看一下您的
listfiles.txt