windows script assistance

R

rogv24

I need to set up a script in windows XP to see if a process is
running. If its running an email should be sent
I am using MS Outlook. I have never coded a script in Windows. The
script should be a scheduled job.

thanks
 
P

Pegasus \(MVP\)

I need to set up a script in windows XP to see if a process is
running. If its running an email should be sent
I am using MS Outlook. I have never coded a script in Windows. The
script should be a scheduled job.

thanks

You could use the Task Scheduler to run this batch file:
@echo off
set [email protected]
set [email protected]
set Host=mail.YourISP.com
set Process=MyProcess
set Subject=%date% %time%: %Process" is running

tasklist | find /i "%Process%" || goto :eof
c:\tools\blat.exe "c:\boot.ini" -f %Sender% -to %Receiver% -server
%Host% -subject "%Subject%"

You can download blat.exe from several sites. If you
have never done this sort of thing before then you will
probably need some assistance from someone who is
familiar with your setup and especially with the SMTP
server operated by your ISP.
 
M

Mark F.

I need to set up a script in windows XP to see if a process is
running. If its running an email should be sent
I am using MS Outlook. I have never coded a script in Windows. The
script should be a scheduled job.

thanks

This is more a programming topic than a Windows XP topic. Before you fiddle
around with any system processes, I recommend that you do some serious
reading on the subject.

http://msdn2.microsoft.com/en-us/library/ms950396.aspx
http://www.microsoft.com/technet/scriptcenter/default.mspx

Also, if you decide to download a script, open it in notepad and read it
carefully before you run it! Newbie scripters can have their machines
trashed by malicious or poorly written code.

Mark
 
R

rogv24

You could use the Task Scheduler to run this batch file:
@echo off
set [email protected]
set [email protected]
set Host=mail.YourISP.com
set Process=MyProcess
set Subject=%date% %time%: %Process" is running

tasklist | find /i "%Process%" || goto :eof
c:\tools\blat.exe "c:\boot.ini" -f %Sender% -to %Receiver% -server
%Host% -subject "%Subject%"

You can download blat.exe from several sites. If you
have never done this sort of thing before then you will
probably need some assistance from someone who is
familiar with your setup and especially with the SMTP
server operated by your ISP.

Thanks for the info.
Is there a safe way to test this. Why would the system be in risk if
only I am checking if a process is running?
The bat file would be called mytest.bat. Then I would just click the
bat file to execute? so windows doesn't have its own software to send
emails I would need to use blat.exe?
 
P

Pegasus \(MVP\)

Thanks for the info.
Is there a safe way to test this. Why would the system be in risk if
only I am checking if a process is running?
The bat file would be called mytest.bat. Then I would just click the
bat file to execute? so windows doesn't have its own software to send
emails I would need to use blat.exe?

It was Mark who warned you about certain risks, not I.
The code I suggested presents no threat at all to your
system and it is not malicious either. You must, of course,
customise it to reflect the settings at your site.

Blat.exe is a popular command line mailer. If you can
find a way to do the same with native Windows tools
then please post it here - after you get it going!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top