BoardBabe Posted October 20, 2005 Posted October 20, 2005 I'm currently running a defrag.cmd (below) from WPI programlist (as normal applications in config.js) to defrag systemdrive.Would it work putting something likecmd1[pn]=['%WinDir%\\system32\\defrag.exe %SystemDrive% -f'] directly into WPI instead of running an external batch?defrag.cmdcmdow @ /HID@echo offrem Defragmenterer systemdisk.call %WinDir%\system32\defrag.exe %SystemDrive% -fexit
glent Posted October 20, 2005 Posted October 20, 2005 being a senior member im surprised you asked instead of just trying it yourself. But yes it should work
BoardBabe Posted October 20, 2005 Author Posted October 20, 2005 Dude, I was just too lazy to do a fresh test install What im thinking is that WPI will pass on to next "task" immediatly after defrag STARTS, whilst in a batch I can CALL the defrag and have the batch wait to exit til defrag is done, so WPI don't skip to next task before defrag has completed.
ColdFusion200 Posted October 20, 2005 Posted October 20, 2005 defrag /?Usage:defrag <volume> [-a][-f] [-v] [-?] volume drive letter or mount point (d: or d:\vol\mountpoint) -a Analyze only -f Force defragmentation even if free space is low -v Verbose output -? Display this help textso just start /wait and then the commandline
BoardBabe Posted October 20, 2005 Author Posted October 20, 2005 actually since its a command utility that wouldnt work, thats why I do CALL not start /wait. Cause it opens up a new command window and the first is terminated.
MHz Posted October 22, 2005 Posted October 22, 2005 actually since its a command utility that wouldnt work, thats why I do CALL not start /wait. Cause it opens up a new command window and the first is terminated.If that is the Call command of the command interpreter, then you should only need to use it for calling a batch file from another or use it to call a label within the batch file. Luckily the command interpreter may overlook the mistake, but it does not mean that you should use it.Most commandline tools will open a command interpreter if needed. Those few that do not, you can just execute another command interpreter by using "%Comspec% /c " or "CMD /c ". The /c puts the command interpreter into commandline mode so you can pass your command to it directly.Defrag will open the command interpreter when executed directly.
gunsmokingman Posted October 22, 2005 Posted October 22, 2005 Have you thought of using a VBS file to defrag, this will run the defrag threw all partition and harddrivesDim Act : Set Act = CreateObject("Wscript.Shell")Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")Dim Df : Set Df = Fso.Drives For Each strDf in Df If strDf.DriveType = 2 Then Act.Run("Defrag " & strDf & "\ -F"),1,True End If Next
BoardBabe Posted October 22, 2005 Author Posted October 22, 2005 I'm not familiar with using VBscripts, are there any advantages? and how is it used?
gunsmokingman Posted October 22, 2005 Posted October 22, 2005 (edited) The vbs starts the defrag in it defualt cmd window, as to the wpi question Ido not know about this as I do not use it. You can start the VBS from a cmd script.StartDefrag.cmd This does not need Start /Wait as it will only flash on the screen a quick cmd promt.Start THE_LOCATION_OF_DEFRAG.VBSI have add a delete the StartDefrag.cmd to the script.This needs the quotes ("PLACE_THE_LOCATION_OF_STARTDEFRAG.CMD_HERE")Re-Edit Save As Defrag.vbsDim Act : Set Act = CreateObject("Wscript.Shell")Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")Dim Df : Set Df = Fso.Drives For Each strDf in Df If strDf.DriveType = 2 Then Act.Run("Defrag " & strDf & "\ -F"),1,True End If NextIf Fso.FileExists("PLACE_THE_LOCATION_OF_STARTDEFRAG.CMD_HERE") ThenFso.DeleteFile("PLACE_THE_LOCATION_OF_STARTDEFRAG.CMD_HERE")End IfSince I do not use WPI you could ask in the forums if you can run a VBS file directly fromWPI, and if you can then use the first code. Edited October 22, 2005 by gunsmokingman
BoardBabe Posted October 22, 2005 Author Posted October 22, 2005 Thank you! Yes you can run it directly from WPI
Senax Posted October 23, 2005 Posted October 23, 2005 Hi,you could use dirms (www.dirms.com) and just rundirms [Drive] -q as dirms is CLI only.Senax
BoardBabe Posted January 6, 2006 Author Posted January 6, 2006 (edited) I dont see how this is "better" than defrag.exe?What's CLI? Edited January 6, 2006 by BoardBabe
MHz Posted January 6, 2006 Posted January 6, 2006 I dont see how this is "better" than defrag.exe?What's CLI?CLI = CommandLinedirms is perhaps only good for Win 2k users who do not have defrag.exe.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now