Jump to content
MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. ×

Killing a Start Menu Folder


TheJerk
 Share

Recommended Posts

Is there a way to kill a start menu folder during runonceex? I know about Internet Explorer, but the only thing I can figure is explorer.exe which would kill the shell, right?

Reason I ask is because Macromedia Studio, which I've decided to use an AutoIt script for (because of the Flash plugin) opens both a webpage from Macromedia as well as the program group folder in the start menu. I can kill the website, but what about the folder?

Link to comment
Share on other sites


As far as I understand it, RunOnceEx runs prior to the explorer shell starting up, if this is the case then you should be able to kill explore.exe to close it down.

Easy way to test... while your runonce is running, hit Ctrl Alt Del.. thatll bring up task mgr and you can see for yourself.

Post up your results

Link to comment
Share on other sites

Reason I ask is because Macromedia Studio, which I've decided to use an AutoIt script for (because of the Flash plugin) opens both a webpage from Macromedia as well as the program group folder in the start menu.  I can kill the website, but what about the folder?

In Autoit, this will close the window, but if still exists, it will try for up to 5 secs. Just that sometimes, a second close message is required, in RunOnceEx.

$title = "TheTitleHere"
WinWait($title)

For $i = 1 To 20
WinClose($title)
If Not WinExists($title) Then ExitLoop
Sleep(250)
Next

Link to comment
Share on other sites

You could use the SendKeys command in vbScript to send an ALT+F4 command to close the window.

See the MS Technet Script Center for example of how to use SendKeys.

Then just call the .vbs file from your RunOnceEx.cmd.

Link to comment
Share on other sites

Well, considering I'm already using AutoIt, I might as well stick to that.

Here's an interesting question, though. Let's say I don't know exactly what the title of the window is that I'm trying to close. For instance, it could be just the name of the folder, or in my preconfigured case could be the entire path including the drive letter. Considering this is a variable and not a constant (given different computer setups), what would be the best method. Does AutoIt use regular expressions (I haven't had a chance to research this just yet)? Would it be best to search the title for a given set of characters and then issue that a close command?

Incidentally, thanks for the input.

Link to comment
Share on other sites

No, not yet. I have to re-setup the OS portion of the CD. I just finished the application portion of it earlier and I'm going to give it a test before I hit the sack tonight (will know by morning what the outcome is).

Link to comment
Share on other sites

Well, considering I'm already using AutoIt, I might as well stick to that.

Here's an interesting question, though.  Let's say I don't know exactly what the title of the window is that I'm trying to close.  For instance, it could be just the name of the folder, or in my preconfigured case could be the entire path including the drive letter.  Considering this is a variable and not a constant (given different computer setups), what would be the best method.  Does AutoIt use regular expressions (I haven't had a  chance to research this just yet)?  Would it be best to search the title for a given set of characters and then issue that a close command?

Incidentally, thanks for the input.

Regular expressions are still in beta. You can close the active window, by just using "" instead of giving a title. Also, WinGetHandle() is an option as well, instead of the title. You could change the Opt() setting for window text to 2. Then you can pick a substring, witch can be part of the name of the folder only.

I would not close the explorer process, while running Autoit scripts. This is a brutal method for a simple problem. This could affect the outcome of your script, unless you insert some code to handle this process. Asking a window to close, is better then killing a main system process.

Link to comment
Share on other sites

I would look for a program called PSKILL.exe. I have noticed on my Unattended Windows 2003 Server installations that TASKKILL.exe doesn't exist on Servers. My point being is that PSKILL.exe has a few more options.

Microsoft Windows XP [Version 5.1.2600]

© Copyright 1985-2001 Microsoft Corp.

C:\>w:

W:\>pskill /?

PsKill v1.03 - local and remote process killer

Copyright © 2000 Mark Russinovich

http://www.sysinternals.com

PsKill terminates processes on a local or remote NT system.

Usage: pskill [\\RemoteComputer [-u Username]] <process Id or name>

-u Specifies optional user name for login to

remote computer.

W:\>

Link to comment
Share on other sites

Agreed. I still haven't had a chance to check if explore.exe is running during runonceex as of yet since my unattended dvd is messed up (I have a seperate thread on that issue in the proper forum). As soon as I've worked through that issue, I'll post back here on my results.

Link to comment
Share on other sites

explorer.exe is running during the runonceex. I was wrong about the folder opening, though. The folder doesn't open until runonceex finishes and the user account opens. Same is true for the internet explorer window that it opens. Is there any way to avoid having those open after the next boot?

Link to comment
Share on other sites

  • 1 year later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...