Doug,
Thanks for the code explanations. I will copy and save along with all the
other good stuff this string generated.
James
Exit codes are "results" codes that are returned to the OS by an
application. They're generally a number. This number can often be tracked
back to the descriptive text of the error, if you know where to look.
For Defrag, the exit codes are:
0 = Completed normally
1 = Cancelled Manually
2 = Command line error
3 = Unknown error
4 = Insufficient memory resources
5 = (Not currently used)
6 = Possible permissions issue (not an Administrator) or a required DLL
could not be loaded.
7 = Insufficient Free Space to defrag.
For example, Return = WshShell.Run("defrag " & d & " -f", 1, TRUE), run in a
VB Script will launch DEFRAG for the drive letter that is assigned to the
variable "d". The TRUE statement tells it to wait for the exit code before
continuing on. Return would represent the 0 thru 7 exit code from DEFRAG.
To see this in action, you can download a script that will defrag all fixed
disks and generate a log file of the activity.
http://www.dougknox.com/utility/scripts_desc/defrag_all.htm
Download defrag_all2.vbs. VBS scripts can be opened and viewed in Notepad.
--
Doug Knox, MS-MVP Windows Media Center\Windows Powered Smart
Display\Security
Win 95/98/Me/XP Tweaks and Fixes
http://www.dougknox.com