0

Is there a way to show a progress bar for the findstr, I'm looking for powershell scripts that contain an explicit password in it, so the developers change their scripts, but there are lot of ps1 files within E drive so we don't know which script has it, I'd like to set a progress bar to know the status of the find, i'm new in batch scripting hope you can help me.

findstr /spin /c:"password" E:\*.sp1 > C:\Users\uescareno\Documents\Scripts\found.txt

I was thinking to use FOR, but not sure if this works:

set "spinner=/-\|"
(
    for (findstr /spin /c:"password" E:\*.sp1 > C:\Users\uescareno\Documents\Scripts\found.txt) do (
        <nul>con set /p"=Searching !spinner:~0,1!!CR!"
        set "spinner=!spinner:~1!!spinner:~0,1!"
        echo %%~tA  %%~xA %%~nA
) echo Searching done
Maximilian Burszley
  • 18,243
  • 4
  • 34
  • 63
  • 2
    This is pure CMD batch code. Why not use PowerShell yourself? It has [native support](https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/write-progress) for reporting progress. – Jeroen Mostert Nov 14 '17 at 15:07
  • Perhaps the answer on https://stackoverflow.com/questions/368041/how-to-code-a-spinner-for-waiting-processes-in-a-batch-file would be helpful. – lit Nov 14 '17 at 17:09
  • Line 1 `set "spinner=/-\|"` contains a pipe unescaped. Try `set "spinner=/-\^|"` – Michael Nov 26 '17 at 05:52

0 Answers0