0

I'm trying to go through a .csv file I've copied in a .txt, and find any line that has any of these characters \ / : * ? " ' < >.

In this code I use find to output all line containing "/", but how can I look for every line with one of the special characters above?


@echo off
setlocal

for /f "delims=" %%I in ('powershell -noprofile "iex (${%~f0} | out-string)"') do (
    mkdir Output
    copy "%%~I" Output\csvCopy.csv
)
for /f "tokens=2,* delims=;" %%a in (Output\csvCopy.csv) do ( echo %%b >> Output\debug.txt )
find /N "/" Output\debug.txt > Output\finalDebug.txt

start "" Output\finalDebug.txt 
pause
@REM delete folder output 
goto :EOF

 : end Batch portion / begin PowerShell hybrid chimera #>

Add-Type -AssemblyName System.Windows.Forms
$f = new-object Windows.Forms.OpenFileDialog
$f.InitialDirectory = pwd
$f.Filter = "CSV Files (*.csv)|*.csv|All Files (*.*)|*.*"
$f.ShowHelp = $true
$f.Multiselect = $false
[void]$f.ShowDialog()
if ($f.Multiselect) { $f.FileNames } else { $f.FileName }
  • Does this answer your question? [Regex in Batch Windows](https://stackoverflow.com/questions/53311950/regex-in-batch-windows) – Mick Mar 24 '21 at 09:47
  • Also try https://stackoverflow.com/questions/34524390/regex-to-match-a-variable-in-batch-scripting and https://stackoverflow.com/questions/41456210/windows-batch-file-regular-expression – Mick Mar 24 '21 at 09:48

0 Answers0