I have a C# .exe file i want to sechdule it in task sechduler.It is running a script so i want that when i am sechduling it
,from there i will pass my script file name,i do not want that it is hardcoded in source code.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sam HobbsPosted Sep 12, 2010, 1:47 PM
Neerav SachdevaPosted Sep 12, 2010, 5:19 AM
that to be a good developer we have to always read lot of thing.Thanks for your concern I will really appreciate you If you will help me on this and tell me about the Documentation.
Neerav SachdevaPosted Sep 12, 2010, 5:19 AM
that to be a good developer we have to always read lot of thing.Thanks for your concern I will really appreciate you If you will help me on this and tell me about the Documentation.
Sam HobbsPosted Sep 12, 2010, 5:11 AM
Neerav SachdevaPosted Sep 12, 2010, 4:01 AM
Sam HobbsPosted Sep 7, 2010, 7:06 AM
lalit pantPosted Sep 7, 2010, 1:48 AM
Neerav SachdevaPosted Sep 7, 2010, 1:39 AM
Here is my sample code:-
/////////////////////////////////////////////////////
Process scriptProc = new Process();
scriptProc.StartInfo.FileName = @"cscript";
//string filePath5 = @"D:\LogRotation\vbsource\NewTextDocument.txt";
string filePath5 = @"G:\Failure Notification\VBScriptSource\vbsourcefile.txt";
string vbfile = null;
if (File.Exists(filePath5))
{
StreamReader file5 = null;
try
{
file5 = new StreamReader(filePath5);
while ((vbfile = file5.ReadLine()) != null)
{
//Console.WriteLine(line);
//oMsg.From = fromfile;
scriptProc.StartInfo.Arguments = @"//B //Nologo " + vbfile;
}
}
finally
{
if (file5 != null)
file5.Close();
}
}
else
{
Console.Write("vbfile does not exist");
}
//scriptProc.StartInfo.Arguments = @"//B //Nologo D:\logrotationex\source\logfiledb.vbs";
scriptProc.Start();
scriptProc.WaitForExit();
Console.Write("executed");
scriptProc.Close();
Dipal ChoksiPosted Sep 6, 2010, 9:56 PM
eg.
try searching (google) for "windows scheduler specify parameters" for specific examples.
Your executable will receive the runtime arguments within the args parameter of the main method
Hope this helps!
Dipal
Sam HobbsPosted Sep 6, 2010, 3:24 PM
Mahesh ChandPosted Sep 6, 2010, 10:59 AM