I'm looking to return a set of values which match my criteria, based upon the results of another tool!
My bat file reads a list of files using the ClearCase tool (as per this question), and writes them to screen. I now want to filter the results, where it only shows me the files which end with .cs (note, there may be other periods in the name)
My code
@echo off
setlocal
for /F "usebackq delims=" %%A in (`cleartool ls -rec ^| find /V "Rule:" ^| find /V "hijacked" ^| find /V "eclipsed" ^| find /V "-->"`) do if %%A==*.cs @echo %%A
I'm lost as to why when I run the following (note the very end of the script is different)...
@echo off
setlocal
for /F "usebackq delims=" %%A in (`cleartool ls -rec ^| find /V "Rule:" ^| find /V "hijacked" ^| find /V "eclipsed" ^| find /V "-->"`) do @echo %%A
...I see lots of results (including files with the .cs extension). But, when I run the first code script, it runs but writes nothing to screen. When I run the second code example, one of the lines I see is
I did try adding quote marks but it made no difference.
if "%%A"=="*.cs"
When I run the second piece of code, the results look like
.\bin\x86
.\bin\x86\Debug
.\Debug\mywork.exe.embed.manifest
.\obj\x86\Debug\myThings.dll
.\Html\MyFile.cs
.\obj\x86\Debug\MyProject\Views\File.baml
.\obj\x86\Debug\MyProject\Views\File.g.cs
.\obj\x86\Debug\MyProject\Views\File.g.i.cs
From the above, ideally I want to only see MyFile.cs (although I can easily live with all the .cs files)