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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

NVITEnd-user supportCommented:
Change to...
findstr /i /r ".Acomba."

Open in new window

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
NVITEnd-user supportCommented:
What is the error for net files | findstr /i /r ".Acomba."
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

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

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

NVITEnd-user supportCommented:
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."')
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
NVITEnd-user supportCommented:
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

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

NVITEnd-user supportCommented:
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

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 !
NVITEnd-user supportCommented:
Glad to help. Have a good one.
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.