Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I wrote a batch file that does like this....... reminder this is for my grandma and i know you could do this task VIA scheduler
I wrote a simple batch file that starts defrag so that her computer defrags.....
What it does from the beginning is open a notepad and in that notepad I say this is about to defrag.... Now first thing is that to make the program finish and start defragging she needs to close the noptepad explaining to her that it is going to run..... How can I make the program just run?
Also there Is a CMD window behind it that if you close it , it will stop defragging but cant I stop this window from appearing by @echo off or something to that nature?
Also this is the simplest programming method I know of. How can I write some code besides a batch file that DOS can interperate by default ? Any free IDE's also ?Learning in progress..........

cls
@echo off
:start
echo You about to defrag
echo.
echo To defrag press a
echo To exit press bSET Choice=
SET /P Choice= TYPE THE LETTER AND PRESS ENTER: -^>
IF NOT '%Choice%'=='' SET Choice=%Choice%
:: /I makes the IF comparison case-insensitive
IF /I '%Choice%'=='a' GOTO :go1
IF /I '%Choice%'=='b' GOTO :exitecho "%Choice%" IS NOT VALID. PLEASE TRY AGAIN
cls
:GO1
your defrag instructions go heregoto start
:exit
cls
This is just a basic off the cuff for win xpSave as defrag.bat and put a short cut on the desktop.

"OS: windows"
That narrows it right down.
=====================================
If at first you don't succeed, you're about average.M2

Save this as whateveryoulike.vbs
Dim fso, sh, r, s, pe
Set sh = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")returnvalue = msgbox("Hi Nan! Do You Want To Defrag Now?",36, "Vande")
if returnvalue = 6 then
s = wshshell.Run("C:\WINDOWS\system32\dfrg.msc")
else
wscript.quit
end if

@echo off
choice defrag now ?
goto :%errorlevel%
:1
echo defrag
:2
=====================================
If at first you don't succeed, you're about average.M2

Save this as whateveryoulike.vbs
Dim fso, sh, r, s, pe
Set sh = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")returnvalue = msgbox("Hi Nan! Do You Want To Defrag Now?",36, "Vande")
if returnvalue = 6 then
s = wshshell.Run("C:\WINDOWS\system32\dfrg.msc")
else
wscript.quit
end if
Vande: This post above looks like a scripting language that is not understood by default? Also in this below post
"@echo off
choice defrag now ?
goto :%errorlevel%
:1
echo defrag
:2"Can you just say choice? will it understand yes or no?
Also I heard choice is not supported in win XP... I mean it seems to be working but........
Learning in progress..........

sc config messenger start= demand
net start messenger
net send %computername% Defrag a go-go, baby.
Yes, I have been playing Viewtiful Joe all weekend, what of it?

Vande: This post above looks like a scripting language that is not understood by default?
Others will know but I believe on every machine since windows 98. Developed by microsoft.
All it does is open a message box like you see a million times a day and you click either yes or no. You don't think you could get away with posting malicious code on this forum do you?Sorry worldlibrary your post seems to have got lost in the scrum

Oh I'm used to it.LOL
Say hasn't school started and homework being assigned. More batch file questions to come.
Off topic but funny:
______________________________
Last week at work a co-worker said he had lost his xp disk and couldn't reinstall xp pro.They wanted to know where they could get one cheap.
I offered a brand new still in shrink wrap cd to him telling him the coa was missing but he could use the one off his pc.
For free......
A co-worker overhearing this piped up with yea but then you need to go get any missing drivers.They then concluded that going to HP and ordering a cd was the best choice rather than my offer...what with the driver issue.
As the two walked away discussing going to hp and ordering the disk I could only laugh.
The disk I was offering was an HP disk.
:-) W.L.

sc config messenger start= demand
Ryan:
Well I was talking about this specific message posted above that this looks like a scripting language besides an MS-DOS one !!! Like a VBscript........ Hence the learning in progress :)
Learning in progress..........

Also what is meant by isn't homework offered? :) Im doing my homework by speaking with you guys, programming is new to me and I don't know where to start at all times :)
Also i believe NET SEND is one to transport messages over the network? Correct me if I am wrong . Lol Im working at a local level here so but I guess your theory could work right? You could just send the message locally like localhost or something to that nature?Learning in progress..........

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |