October 20, 200520 yr 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
October 20, 200520 yr being a senior member im surprised you asked instead of just trying it yourself. But yes it should work
October 20, 200520 yr Author 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.
October 20, 200520 yr 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
October 20, 200520 yr Author 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.
October 22, 200520 yr 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.
October 22, 200520 yr 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
October 22, 200520 yr Author I'm not familiar with using VBscripts, are there any advantages? and how is it used?
October 22, 200520 yr 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, 200520 yr by gunsmokingman
October 23, 200520 yr Hi,you could use dirms (www.dirms.com) and just rundirms [Drive] -q as dirms is CLI only.Senax
January 6, 200620 yr Author I dont see how this is "better" than defrag.exe?What's CLI? Edited January 6, 200620 yr by BoardBabe
January 6, 200620 yr 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.
Create an account or sign in to comment