close, but no cigarr Lonkero [Smile]

Your line didn't work either, but it got me thinking.
(finally... [Wink] )

I changed your line from:
quote:

shell ' %comspec% /c dsquery "group OU=Some_school,OU=Schools,DC=school,DC=mycompany,DC=com -scope subtree -name Students" > c:\myfile.txt'

To this:
quote:

shell '%comspec% /c dsquery group OU=Some_school,OU=Schools,DC=school,DC=mycompany,DC=com -scope subtree -name Students > c:\myfile.txt'

And finally...

It WORKS!! [Big Grin] [Big Grin]

The solution was so simple... it was the singel quotes that was missing.
Never even thought about them until you used them.
Heck, now it even works without the "%ComSpec% /C"

How could I have missed them?
It's like:
Glasses on --> "Hi Clark Kent"
Glasses off --> "Who's that?!?    Oh! it's Superman!"

Thanks a bunch guys for putting up with my stupid questions

/V