Re: VBScript added to Scheduled Task



Hi neualex,
A quick change and you'll be good to go! Try this:

Dim wshShell, s
Set wshShell = CreateObject("Wscript.Shell")
s = "notepad"
wshShell.Run s,1,True

Notice the 1 in the run command instead of the 0. This is the window
type parameter. A 0 in this parameter runs the program but hides the
window. A 1 activates the window and displays it. There are other
window type parameter options which you can review at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/6f28899c-d653-4555-8a59-49640b0e32ea.asp

Hope this helps.

James Garringer



neualex wrote:
Hi guys

I created a very simple vbscript that runs notepad:

Dim WshShell, oExec, s
set WshShell = CreateObject("WScript.Shell")
s= "cmd /c notepad "
oExec = WshShell.run(s,0,True)
set WshShell = nothing

This script is added to the Schedule Task in Windows 2000.
The task is run with an admin user.

The problem is that the task seems to be run, but I don't see the notepad.
If I go to the taskmgr I can see the notepad in the list, but it doesn't pop
up visually.

Did anything like that happen to you guys?

Thank you.

.



Relevant Pages

  • Re: Finding application window
    ... "Notepad" you would use the following: ... Set WshShell = CreateObject ... The problem is finding the application window. ... As with any scripting task, there can be dozens of ways to accomplish ...
    (microsoft.public.scripting.vbscript)
  • Re: cacls help
    ... SHOULD open up notepad. ... Dim WshShell ... Set WshShell = WScript.CreateObject ... > xcacls.exe to set permissions on each users home ...
    (microsoft.public.win2000.security)
  • WScript.Shell
    ... I am trying to use run function of WScript.Shell in my asp code to simply open a notepad for test. ... Dim WshShell, intReturn ... Set WshShell = server.CreateObject ...
    (microsoft.public.scripting.wsh)
  • RE: Importing Txt file into Excel
    ... I looked at the Fixed TXT file in Notepad ... hopefully your new macro will work. ... from the web post into the VBA window, I ran the Code by pressing F5 from the ... If FoundCR = True Then ...
    (microsoft.public.excel.programming)
  • Re: Application to Tray
    ... I think you can cheat a little by using the SetWindowPos API. ... Your VB program can issue a window message to, say, notepad (or ... When the user double clicks the notepad icon on the system tray, ...
    (comp.lang.basic.visual.misc)