Technical Article

how to start a program like Notepad.exe in a job

,

sometime I need to kill an program which does not continue to process data, and i sheduled a job to do that. After lots of times' try, I made it at last.

This script add a shedule to the sheduled task list, one minutes later then the current system time. You can change it by edit the @RunTime string,

And this is my first Script submitted, I hope it help.


The most core part is below:

declare @RunTime char(5)
declare @String char(100)
set @RunTime=left(convert(char(5),getdate(),8),2) + ':' + convert(char(2),convert(int,right(convert(char(5),getdate(),8),2) )+1,2)
set @String='at '+ @RunTime + ' /interactive ' + ' C:\windows\system32\notepad.exe'
exec ('master..xp_cmdshell "'+@String +'"')

Rate

4 (1)

You rated this post out of 5. Change rating

Share

Share

Rate

4 (1)

You rated this post out of 5. Change rating