Good afternoon, if anyone can help me with this i would be most appreciative
Im looking for a way to invoke the Defrag through visual basic, the defrag part i can do but i want to be able to analyze it first, to see if actually needs defragmentation
i know you can use Run
--> CMD --> defrag.exe C: -A
to analyze it, but the question is does it log it anywere? if it writes to a log file then i can just read the logfile.
The problem is i have a lot of hard drives contained within my computer, and files are always being moved, deleted, transferred, renamed and general havoc really so i want to write an efficient program in vb that will take control of that side of it so its one less thing to worry about. I noticed a post on defrag vbscript but cant makes heads or tails out of it.
Any help would be appreciated
Thank you
Kind Regards
Devon.
5 4344
Im looking for a way to invoke the Defrag through visual basic, the defrag part i can do but i want to be able to analyze it first, to see if actually needs defragmentation
This is a big problem. Thats better if you use existing Defragment Tool from Windows
i know you can use Run
--> CMD --> defrag.exe C: -A
to analyze it, but the question is does it log it anywere? if it writes to a log file then i can just read the logfile.
If you want log to file, so do this command: "DEFRAG C: -A >D:\LogFile.TXT"
The problem is i have a lot of hard drives contained within my computer, and files are always being moved, deleted, transferred, renamed and general havoc really so i want to write an efficient program in vb that will take control of that side of it so its one less thing to worry about. I noticed a post on defrag vbscript but cant makes heads or tails out of it.
Defragment Tools can be schedule to run any time, any where (any driver) as you want
This link seems as though it may be relevant, though probably not exactly what you're looking for.
The interesting part starts about half way down, with " Provide Event Logging for Disk Defragmenter Utility with WSH".
Thank you both for the input, very helpful, now im faced with another difficutly, i wish to do the Defrag Analyze silently. but when i try and shell
%SystemRoot%\System32\Defrag.exe C: -a -v >D:\LogFile.txt
the window just appears and disapears and does not process the command and when i try and when i shell the command
%SystemRoot%\System32\CMD.exe /c defrag.exe c: -a -v >D:\LogFile.txt
(/c Switch terminates window after use)
it shows up the window, now is there anyway to make this window hide, or appear off the screen, i just dont want like 8 different command prompt windows popping up one after the other lol.
Thanks Again
Kind Regards
Devon
Just from memory, doesn't Shell have one or more parameters that let you specify whether to run maximised/minimised, with/without focus?
Just from memory, doesn't Shell have one or more parameters that let you specify whether to run maximised/minimised, with/without focus?
Thank you kindly, least someone has got their head screwed on, i remember when exactly what it was as soon as you mentioned Maximised/Minimised... It was the hide one. I will display the basic code for the primary question. -
'This code will Analyze drive C with the Administrator/Developer defrag Application
-
'(C:\Windows\System32\defrag.exe)
-
'Switches -
-
' CMD: /c (Closes the CMD window after completion
-
' Defrag: -a (Analyze Only) -v (Verbus Output) >d:\lg.log (Outputs Data To File)
-
-
Shell "C:\Windows\System32\CMD.exe /c defrag.exe C: -a -v >C:lg.log", _
-
vbHide
-
Shell Options:
vbNormalFocus
vbNormalNoFocus
vbMaximizedFocus
vbMinimizedFocus
vbMinimizedNoFocus
vbHide
As much basic information as i can think of but thanks for your help, Both of you :-)
Kind Regards
Devon
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jim Hubbard |
last post by:
Anyone got any info or code examples on defragging your hard drives?
|
by: csomberg |
last post by:
SQL 2000
We took SQL Server offline last night and defragged the SAN. Should we
reindex or will be be okay ?
Thanks,
Craig
|
by: Isaac |
last post by:
You can perform a defrag by moving tablespaces.
Is there a generic script that I can use to run after hours?
|
by: Mohammad-Reza |
last post by:
Hi
Please tell me how I can defrag my memory.
Is there any component that can do this?
Is it possible in .NET to do this?
How can I do this?
Thanks in advance
|
by: Jim Hubbard |
last post by:
Anyone got any info or code examples on defragging your hard drives?
|
by: iwdu15 |
last post by:
hi, i was wondering if anyone could help me or show some sample code to run
disk defrag and handle the error if theres less than 15% free space...ive
tried but i cant seem to get it to start to...
|
by: jaeden99 |
last post by:
I have found a vbscript on the internet that I would like to add some additional info to:
See below. I want to be able to get and save the computer name to each defrag log on a specified server...
|
by: =?Utf-8?B?TG95ZCBDb3VudHM=?= |
last post by:
My defrag stoped on windaws Visea Home.
I have tried everything I know and it just wont work.
I tried it in TOOLS and in MY COMPUTER opening C: and hit properties and
pull tools and hit...
|
by: =?Utf-8?B?RHVhbmU=?= |
last post by:
I unistalled Norton Ghost 14.0 and when I went to defrag my HD, I got this
error -- basically saying it could not defrag the HD. Here are the specifics
of my results. Any help is appreciated!...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |