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,
ti-guyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NVITCommented:
Change to...
findstr /i /r ".Acomba."

Open in new window

0
ti-guyAuthor Commented:
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
0
NVITCommented:
What is the error for net files | findstr /i /r ".Acomba."
0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

ti-guyAuthor Commented:
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>

Open in new window

0
ti-guyAuthor Commented:
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

Open in new window

0
NVITCommented:
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."')
0
ti-guyAuthor Commented:
I still get that same error

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."')

Open in new window


And thanks a lot for your time
0
NVITCommented:
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

Open in new window

0
ti-guyAuthor Commented:
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>

Open in new window

0
NVITCommented:
The last code is missing the closing single quote. Fixed here:

net files
net files | findstr /i /r ".Acomba."
for /F %%a in ('net files ^|findstr /i /r ".Acomba."') do net files %%a /close

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ti-guyAuthor Commented:
It works, thanks a lot !
0
NVITCommented:
Glad to help. Have a good one.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2008

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.