Sign in to follow this  
Followers 0
nobby

Processclose

4 posts in this topic

Hey,

I am running a simple script to backup a database to a mapped network drive so it is put on tape nightly.

Unfortunately, the function ProcessClose does not stop the SQLSERVR.EXE process.

RunAsSet("Administrator", "DOMAIN", "PASSWORD")
ProcessClose("sqlservr.exe")
FileCopy("C:\Program Files\Microsoft SQL Server\MSSQL\Data\DATABASE", "MAPPED network drive", 1)
Shutdown(9)

Where the following does stop the server

RunAsSet("Administrator", "DOMAIN", "PASSWORD")
RunWait(@comspec & " /c Net stop MSSQLserver","",@SW_HIDE)
FileCopy("C:\Program Files\Microsoft SQL Server\MSSQL\Data\DATABASE", "MAPPED network drive", 1)
Shutdown(9)

Is there a way of forcing a process to close rather than trying to close it gracefully?

Cheers

Nobby :whistle:


CheersNobby

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Have you tried the force flag?

The shutdown code is a combination of the following values:

0 = Logoff

1 = Shutdown

2 = Reboot

4 = Force

8 = Power down

Edit .. this is for the Shutdown() call :whistle:

Edited by trids

Share this post


Link to post
Share on other sites

Thanks for the reply.

I was hoping to be able to close the process without calling for an external application.

Could this be an option to add in future release of AutoIt??

ProcessClose("process.exe", "flag")

Flag 1 = Gracefull close

Flag 2 = Forcefull close

Cheers :whistle:


CheersNobby

Share this post


Link to post
Share on other sites

Larry,

Why not indeed. That's how I am running it now and it works fine.

Thanks.


CheersNobby

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