|ok guys i have this code that works in Vista and XP but not windows 7 |
for /f "delims=" %%a in ('2^>^&1 ^>nul defrag -? %systemdrive%') do set notadmin=%%a
if defined notadmin (
echo Not admin!
the issue is that in windows 7 the -? wont work so what else could i use in place of it to make it work out for me?
i use this code to check admin right and tells the user if they are runing the batch with Admin rights or not..
**EDIT** forgot to mention that the - a takes forever because it analizes the drive and i dont want the batch to do that. so in vista and xp the -? worked out great but in windows 7 the code is just skiped over.
thank you for you help!