Jump to content
Sign in to follow this  
zedogas

_rundos to "for /f tokens=*" command

Recommended Posts

zedogas

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
Mat

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
zedogas

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.