ti-guy
asked on
batch file not working
Hi,
Anyone see what's wrong here ?
net files | findstr /i "*.Acomba.*"
for /F %%a in ('net files ^|findstr /i "*\Acomba.*")
do net files %%a /close
Thanks,
Anyone see what's wrong here ?
net files | findstr /i "*.Acomba.*"
for /F %%a in ('net files ^|findstr /i "*\Acomba.*")
do net files %%a /close
Thanks,
ASKER
On both places ? I still get an error..
net files | findstr /i /r ".Acomba."
for /F %%a in ('net files ^|findstr /i /r ".Acomba.")
do net files %%a /close
net files | findstr /i /r ".Acomba."
for /F %%a in ('net files ^|findstr /i /r ".Acomba.")
do net files %%a /close
What is the error for net files | findstr /i /r ".Acomba."
ASKER
The error happens on the second line.
C:\Temp>test.bat
C:\Temp>net files | findstr /i /r ".Acomba."
The syntax of the command is incorrect.
C:\Temp>for /F %a in ('net files ^|findstr /i "*\Acomba.*")
C:\Temp>
ASKER
This is what is in the .bat already. Not sure why it says only % on display...
net files | findstr /i /r ".Acomba."
for /F %%a in ('net files ^|findstr /i /r ".Acomba.")
do net files %%a /close
Add closing single quote at end, right before parenthesis, i.e.
for /F %%a in ('net files ^|findstr /i /r ".Acomba.")
becomes
for /F %%a in ('net files ^|findstr /i /r ".Acomba."')
for /F %%a in ('net files ^|findstr /i /r ".Acomba.")
becomes
for /F %%a in ('net files ^|findstr /i /r ".Acomba."')
ASKER
I still get that same error
And thanks a lot for your time
C:\Temp>test.bat
C:\Temp>net files | findstr /i /r ".Acomba."
The syntax of the command is incorrect.
C:\Temp>for /F %a in ('net files ^|findstr /i /r ".Acomba."')
And thanks a lot for your time
Run net files by itself. What does it return?
net files
net files | findstr /i /r ".Acomba."
for /F %%a in ('net files ^|findstr /i /r ".Acomba." ) do net files %%a /close
ASKER
C:\Temp>test2.bat
C:\Temp>net files
There are no entries in the list.
C:\Temp>net files | findstr /i /r ".Acomba."
C:\Temp>for /F %a in ('net files |findstr /i /r ".Acomba.") do net files %a /clo
se
The system cannot find the file 'net files |findstr /i /r ".Acomba.".
C:\Temp>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It works, thanks a lot !
Glad to help. Have a good one.
Open in new window