Click here to Skip to main content
15,899,474 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have created a windows application using C#,.NET.

When I double click on the application file created in the \bin\Debug folder, the application gets executed properly. Now I need to achieve the same by creating a batch file and schedule it for executing it every 10 mins.
I have created a .bat file (using notepad)in the same folder (\bin\Debug ) with the following two lines:

@echo off
start D:\Projects\BatchFileApp\BatchFileApp\bin\Debug\BatchFileApp

Also, I have scheduled this .bat file in the Scheduled Tasks.

The problem is whenever the scheduled task runs, it simply opens the .bat file(in a notepad) but does not execute the application.

Pls guide. An early response is appreciated.

Thanks.
Posted

I have seen this before where the user has the windows setting for 'Hide Common File extensions' switched on.

When the file is save it actually is called 'thefile.bat.txt' and as a result is being opened in notepad.

You need to check that the file is saved as '.bat' and not '.bat.txt'
 
Share this answer
 
Comments
Sarita Ray 13-May-10 23:25pm    
Thanks a lot Daveauld. Your suggestion helped!!
You can Create a Windows Service for the Same, where you can create a small service that would handle all the functionality for you. or You may Create a Small Executable file and through Windows Service you can execute that file or along with using System.Diagnostics.Start.Process("Your File Path To be Executed"), also you can execute the same batch file using the same command and before executing just check the Full File Name with the extension.
 
Share this answer
 
Comments
Sarita Ray 13-May-10 23:32pm    
Windows Service is a logical workaround. But as per requirement, I have to do this only through batch file & scheduler. Anyways, thanks for the suggestion Maxuser.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900