D program in Windows Task Scheduler.

Vino vino.bheeman at hotmail.com
Tue Nov 28 09:44:39 UTC 2017


Hi All,

  I have small D program which run's perfectly when i run it 
manually, but when I schedule the same via windows task scheduler 
and choose the option "Run whether user is logged on or not" the 
program does not execute, the task scheduler job log return code 
4294967295(Invalid argument). SO request you help on this.

Execution Steps
test.exe <option>

Option: run , dryrun  ,help

Example Execution : test.exe dryrun
Program:
import std.stdio;
import std.getopt;
import std.path;
import core.stdc.stdlib: exit;

void Test1(string Step) {
writeln("This is Test1 :", Step);
}
void Test2() {
writeln("This is Test2");
}
void Test3() {
writeln("This is Help");
}

void main (string[] args) {
if (args.length <= 1 || args.length > 2 ) { writeln("No Arguments 
Provided"); exit(-1); }
string op = args[1];
try {
getopt(args, std.getopt.config.caseInsensitive, 
std.getopt.config.stopOnFirstNonOption);
  switch (op) {
  	case "dryrun" , "run" :
		auto Step = op;
		Test1(Step);
		Test2;
		break;
	case "help" :
		Test3;
		break;
	default :
		 writefln("Unknown operation");
	}
} catch (Exception exc)
	{ writefln("Error processing command line arguments: %s", 
exc.msg);}
}

From,
Vino.B


More information about the Digitalmars-d-learn mailing list