Jump to content

_rundos to "for /f tokens=*" command


Recommended Posts

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.

Link to comment
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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...