Gryff
asked on
Want to dynamically create a scheduled task or similar to delete a file in 30 days. Must work on any windows system.
Hi there,
I have created a basic installed (using the excellent Inno setup program) that will load a demo set of postcode data for one of our products. This is intended as a demo and I would like a way to setup a scheduled task to delete the demo data in approx 30 days.
This doesn't warrant a full on proper lock down as used in various shareware programs, and we would prefer not to load custom programs onto the system to delete the files. A single freeware standalone program or batch file is fine, but nothing requiring active installation. We don't mind if the occassional system doesn't successfully delete the file (say 1 in 50 or so) nor do we particularly mind if someone with some IT knowledge can circumvent the scheduled deletion.
I have tried playing around with the AT command and the SCHTASKS command, but I either encounter problems with dynamically determining 30 days in the future, or require the user to enter a network password.
Any suggestions?
I have created a basic installed (using the excellent Inno setup program) that will load a demo set of postcode data for one of our products. This is intended as a demo and I would like a way to setup a scheduled task to delete the demo data in approx 30 days.
This doesn't warrant a full on proper lock down as used in various shareware programs, and we would prefer not to load custom programs onto the system to delete the files. A single freeware standalone program or batch file is fine, but nothing requiring active installation. We don't mind if the occassional system doesn't successfully delete the file (say 1 in 50 or so) nor do we particularly mind if someone with some IT knowledge can circumvent the scheduled deletion.
I have tried playing around with the AT command and the SCHTASKS command, but I either encounter problems with dynamically determining 30 days in the future, or require the user to enter a network password.
Any suggestions?
ASKER
Thanks SirBounty,
Currently the installer just installs data, no programs at all. I am fairly proficient with VB6 and could easily make a program to meet my needs there, but then it needs to be installed along with all the runtime files etc which we want to avoid.
I am trying to find a solution that doesn't require any new programs to be installed on the client machine, or at the very least a single stand along program.
One day I will take the time to learn .net, but today is not that day :/
Currently the installer just installs data, no programs at all. I am fairly proficient with VB6 and could easily make a program to meet my needs there, but then it needs to be installed along with all the runtime files etc which we want to avoid.
I am trying to find a solution that doesn't require any new programs to be installed on the client machine, or at the very least a single stand along program.
One day I will take the time to learn .net, but today is not that day :/
Write the date to the registry or to a hidden file somwhere that stores the install date. Keeping it in hex or some other somewhat encrypted form will prevent most people from finding a way around it.
In your programming check the registry/file for the install date and put your expiration code (delete, quit, annoy user) at the launch/startup of the application.
In your programming check the registry/file for the install date and put your expiration code (delete, quit, annoy user) at the launch/startup of the application.
ASKER
I managed to determine how to dynamically set the date for the AT command in Inno Setup so I no longer need help on this subject.
For anyone who uses Inno Setup and has a similar requirement in the future I will include the code I used below. To be honest it was probably a trivial thing for anyone with more experiance in Inno Setup and/or Pascal than me. This will set the delete time as 1:00 am on the same day in the following month (unless you are installing it between midnight and 1am.)
[Run]
Filename: at; Parameters: 01:00 /next:{code:GetDate} {app}\removedat.bat; Flags: runhidden
[Code]
function GetDate(S: String): String;
begin
{ Return the selected DataDir }
Result := getdatetimestring('dd', '/', ':');
end;
For anyone who uses Inno Setup and has a similar requirement in the future I will include the code I used below. To be honest it was probably a trivial thing for anyone with more experiance in Inno Setup and/or Pascal than me. This will set the delete time as 1:00 am on the same day in the following month (unless you are installing it between midnight and 1am.)
[Run]
Filename: at; Parameters: 01:00 /next:{code:GetDate} {app}\removedat.bat; Flags: runhidden
[Code]
function GetDate(S: String): String;
begin
{ Return the selected DataDir }
Result := getdatetimestring('dd', '/', ':');
end;
Thanx Gryff for posting that. I 'only' use Inno, but wouldn't have known how to accomplish this without your solution.
gj99116 - I will have the points refunded here, unless you have an objection?
gj99116 - I will have the points refunded here, unless you have an objection?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You should also be able to accumulate the date easily in your code - are you using VB?
NewDate=DateAdd("d", 30, Date)