Sign in to follow this  
Followers 0
tetotaly

vista cmd window doesn't close

5 posts in this topic

#1 ·  Posted (edited)

When I close a CMD-process by its PID (which I read from a file) under Vista, the process disappears from the taskmanager's tasklist, but the cmd window stays open and ist completely usable, i.e. the process running in it is still active. Under WinXP the same script works properly and closes the window and the process. Did I do sth wrong?

I would be very happy about any suggestions and ideas.

Thanks

- tetotaly

$file = FileOpen ( "pid.txt", 0 )
$PID = FileRead( $file,4)
FileClose($file)
ProcessClose ( $PID)

edit: I'm using AutoIt v3.2.4.9 and the script runs as an *.exe file with admin properties.

Edited by tetotaly

Share this post


Link to post
Share on other sites



How can I kill the window by its PID? Unfortunately the title isn't distinct and I don't want to close te other CMDs.

Share this post


Link to post
Share on other sites

How can I kill the window by its PID? Unfortunately the title isn't distinct and I don't want to close te other CMDs.

Unfortunately for you, FileRead does not return a Process Identifier number unless the PID is stored within the file. You maybe able to search the forum for a UDF named something like "WinTitleByPID" or similar. Members have created UDFs already to handle these kind of issues.

:whistle:

Share this post


Link to post
Share on other sites

Yes, I store the PID in the file. I found a solution now with a combination of ProcessClose and WinKill.

But thanks anyway. :whistle:

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0