Jump to content

hiding sched task window box


Recommended Posts

Posted

I have defrag.exe running as part of a scheduled task using my login username.

When the scheduled task starts, it displays an empty popup box.

Is there a way to run the scheduled task without showing me a popup box? Sort of

like a silent run mode......

For windows 2K, the best match for windows XP defrag is the filename called

dfrgntfs.exe in the system32 directory. However, I can't get it to show me

any commandline options so that I know what to specify when I setup the

dfrgntfs.exe (defrag) utility under win 2K. Are there any options for Win 2K defrag?

My win XP defrag uses the following commandline "defrag.exe C: -f"


Posted

I wrote an AutoIt v3 script to do this, see www.autoitscript.com. You can compile the wh.au3 into a stand-alone .exe file.

-John

;
; wh.au3 -- winhide
; -John Taylor
; Oct-12-2006
;
; I use this to hide svchost cmd windows that are
; launched from a Scheduled Task
;
; 1st cmd-line arg : partial window title
; 2nd cmd-line arg : optional, always should be "1", shows a windows
; instead of hiding one
;

#notrayicon
Opt("MustDeclareVars", 1)
Opt("WinTitleMatchMode", 2)

Const $max = 4
Dim $rv, $i

if 0 == $CmdLine[0] then
MsgBox(16, "Error", "You must give a partial window title on the command-line.")
exit
endif


if 1 == $CmdLine[0] then
for $i=1 to $max
$rv = WinSetState ( $CmdLine[1], "", @SW_HIDE )
next
endif


if 2 == $CmdLine[0] then
if "1" == $CmdLine[2] then
for $i=1 to $max
$rv = WinSetState ( $CmdLine[1], "", @SW_SHOW )
next
endif
endif

;
; end of script

Posted

Thanks iftuga, I'll try it out.

I've also found out that Win 2K doesn't allows the dfrgntfs.exe to be run under the sched task.

Defrag was added to allow this under windows. In my searches, I came across this which wraps

the dfrgsntfs.exe on Win 2K machines to allow one to do defrags at scheduled times on Win 2k.

http://sourceforge.net/projects/autodefrag/

I'll try autodefrag v1.2 out later along with the above script too.

I also know that defrag.exe can be run using the "at" command, (but not for win 2k per above comment).

This seems to be the only way to allow me to run defrag without being logged in as a user which has admin

privelges.

Posted

IFTUGA,

How do I use this with the sched task "defrag.exe"?

I've compiled it and ran at the command prompt "wh t 1"

Or is it "wh 1 c:\windows\system32\defrag c: -f"

Or ???

Why do I need a partial window name?

Posted (edited)

IFTUGA,

The wh program that you posted doesn't seem to stop the popup windows under the sched task.

I've done the following.

a). Entered the following command within the RUN box of sched task

wh defrag;defrag.exe C:

b ). Put the wh and defrag commands in a batch file and entering the batch filename in RUN box of sched task.

wh defrag

defrag.exe C:

c). The only way I can get the box to disappear is to run "defrag.exe C:" as user

NT AUTHORITY SYSTEM without a password. It seems to run, but am not sure if it is doing anything.

Edited by mikesw

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...