Sign in to follow this  
Followers 0
zedogas

_rundos to "for /f tokens=*" command

3 posts in this topic

Hi friends I need a little help. I have a batch command that works fine (.bat or .cmd):

for /f "tokens=*" %%i in ('Net Localgroup sector ^| find /I /V "Alias" ^| find /I /V "Membros" ^| find /I /V "coment rio" ^| find /I /V "------" ^| find /I /V "comando"') Do Net Localgroup sector "%%i" /Delete

It deletes FINE all users and groups in localgroup "sector". So, when I send to autoit the command:

#include <process.au3>
_RunDOS("for /f " & '"tokens=*"' & " %i in ('Net Localgroup sector ^| find /I /V " & '"Alias"' &  " ^| find /I /V " & '"Membros"' & " ^| find /I /V " & '"coment rio"' & " ^| find /I /V " & '"------"' & " ^| find /I /V " & '"comando"' & ") Do Net Localgroup sector " & "%i" & " /Delete")

doesn't WORK.

I tried a more % in %i (%%i), but doesn't work too... So, any ideas? What's wrong here?

Thanks.

Share this post


Link to post
Share on other sites



I would not advise mix single and double quotes like you have, I would have done this:

_RunDOS("for /f ""tokens=*"" %%i in ('Net Localgroup sector ^| find /I /V ""Alias"" ^| find /I /V ""Membros"" ^| find /I /V ""coment rio"" ^| find /I /V ""------"" ^| find /I /V ""comando""') Do Net Localgroup sector ""%%i"" /Delete")

Also, I would not use dos... Use AutoIt instead. There are net user functions on the forum, so see if you can find what you want by searching.

Mat

Share this post


Link to post
Share on other sites

Dude, you're amazing. Thanks (very much) for help me. Closed case.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0