In a cmd
window I search for a specific file then pass it into an executable. I want to redo this using PowerShell, with similar constraints on being on a single line or two independent and separate lines, but being new I can't figure it out.
cmd /r dir /s /b RunnerUnitTest.dll | findstr /r bin\\ > tests_list.txt
cmd /r for /f %f in (tests_list.txt) do vstest.console.exe "%f"
The first command looks for a file, it finds two:
RunnerUnitTest\bin\Debug\RunnerUnitTest.dll
RunnerUnitTest\obj\Debug\RunnerUnitTest.dll
then it narrows it down to one (bin in the path) and sticks it into a file:
RunnerUnitTest\bin\Debug\RunnerUnitTest.dll
The second line takes this output and passes it into an executable as a parameter.
This is for a gitlab runner, btw