在注册表中,加入:
sName1:='ABC'; // 程序名称
sValue1:= ExtractFilePath(application.ExeName) + 'ABC.exe'; // 绝对路径
Reg:=TRegistry.Create;
Reg.RootKey:=HKEY_LOCAL_MACHINE;
try
Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Run',False);
Reg.WriteString(sName1,sValue1);
finally
Reg.CloseKey;
Reg.Free;
end;
sName1:='ABC'; // 程序名称
sValue1:= ExtractFilePath(application.ExeName) + 'ABC.exe'; // 绝对路径
Reg:=TRegistry.Create;
Reg.RootKey:=HKEY_LOCAL_MACHINE;
try
Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Run',False);
Reg.WriteString(sName1,sValue1);
finally
Reg.CloseKey;
Reg.Free;
end;
启动任务和其他任务一样只是参数不同而已
NetScheduleJobAdd Submits a job to run at a specified future date and time.
NetScheduleJobDel Cancels a range of jobs queued to run on a computer.
NetScheduleJobEnum Lists the jobs queued on a specified computer.
NetScheduleJobGetInfo Returns information about a particular job queued on a computer.
GetNetScheduleAccountInformation Retrieves the AT Service account name.
SetNetScheduleAccountInformation Sets the AT Service account name and password.