Project for school

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Mister Fox
Posts: 7
Joined: 20 Feb 2012 08:14
Location: Behind you
Contact:

Project for school

#1 Post by Mister Fox » 21 Feb 2012 14:51

I just got notified of a school project in which we need to create a product and make a commercial for it.

I was thinking about making a batch file that defragments your hard drive (among other things) and in the end speeds up your computer.

I just have 2 problems- What to put in this file (what should it do) and how to put it into the file (obviously it has to actually work)

That's where you guys come in.

Can anyone suggest something that should go in this batch file? Please include instructions for how to use the code in your response.

Thank you.

alan_b
Expert
Posts: 357
Joined: 04 Oct 2008 09:49

Re: Project for school

#2 Post by alan_b » 22 Feb 2012 10:24

I suggest you think again.

Windows has things known as API's that do a lot of dirty low-level operations to the system and to the HDD.

Commercial Defragmenters use those API's because otherwise by the time Defrag has chosen an empty track/sector for a move,
Windows may have already leapt in and written something vital that should not be over-writen

I doubt that those API's are accessible to a batch file running under CMD.EXE running under Windows.

If you did have access to those API's, then after your first use and inevitable "gotcha" you will have to :-
Format the HDD;
Install Windows;
Install Applications;
Restore user documents.

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: Project for school

#3 Post by Ed Dyreen » 22 Feb 2012 14:43

'
try

Code: Select all

defrag /?
Can't really help cause I use diskeeper and have it automated with au3 ( which isn't batch ).

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Project for school

#4 Post by aGerman » 22 Feb 2012 15:26

I agree with Alan. You can't do so much with Batch. The reason is simple. There are only two (perhaps three) sets of things you can use with batch.
- First are the internal functions of cmd.exe.
- Second are the "native" command line tools that come with Windows (you'll find them in the Sytem32 directory).
- Third are other third party tools that accept parameters from the command line.

As Alan already mentioned, you have no access to the operating system except via those tools written in other programming languages. That means, if there is no fitting function or no suitable tool you have no chance to achieve anything with batch. Hence as Alan feared you have no access to WinAPI functions directly (you need a tool that would do this job).

However, I'm not here to discourage you. There are some minor things you could try with batch.
DEFRAG, CHKDSK, CHKNTFS (defragging, checking disk)
DEL, RD (erasing empty/temporary files/folders)

Perhaps somebody else could propose additional possibilities.

Regards
aGerman

Post Reply