Q> Как "зашедулить"
задачу ?
A>
#include <windows.h>
#include <lm.h>
#include <stdio.h>
#include <stdlib.h>
#pragma hdrstop
#define BREAK_ME 1 /// #undef to get working code
#undef BREAK_ME
#pragma pack( push )
#ifdef BREAK_ME
#pragma pack( 2 )
#else
#pragma pack( 4 )
#endif
#include <lmat.h>
#pragma pack( pop )
#define lenof(x) ( sizeof (x) / sizeof (x)[0] )
int main( int argc, char *argv[] )
{
wchar_t server[256], cmd[1024];
AT_INFO at;
DWORD rc, id;
if ( argc < 2 || argc > 3 )
{
puts( "usage: nsja [\\\\server] \"command\""
);
return 1;
}
if ( argc > 2 )
mbstowcs( server, argv[2], lenof( server ) );
else
server[0] = L'\0';
mbstowcs( cmd, argv[argc - 1], lenof( cmd ) );
memset( &at, '\0', sizeof at );
at.Command = &cmd[0];
rc = NetScheduleJobAdd( server, (byte *) &at, &id );
if ( rc != ERROR_SUCCESS )
printf( "NSJA() returned %lu\n", rc );
return 0;
}