Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi all,
I am working on a batch file which comprises a Call statement to execute an application. This application only starts if the date is set to a certain date.
Right before my call statement, I save the actual date then I set it to the desired one. After the Call statement, I set it back. No problem up to here.
I am trying to find a simple way to restore the date right after the application has started so that the files saved by the application have the proper date!
Thank you for your hints!
greeds,
Lin

Didn't we go through this a couple days ago?
=====================================
If at first you don't succeed, you're about average.M2

I have found a couple of methods to change date and time but i coulnd find anything helpfull for my problem.
The problem here is that in my batchfile the proper date is restored only after the end of the application execution.
the time should be restored right after the Call comand and during the application execution.
If this has already been discussed i apologize for posting a similar question. In this case you could post a link to this discussion.

For starters, you don't call an application. CALL is for batch files.
set DSAV=%DATE%
set TSAV=%TIME%
start MYAPP.exe
set date=%DSAV%
set time=%TSAV%
=====================================
If at first you don't succeed, you're about average.M2

This is exactly what i am using for changing date and time.
the crucial part looks like that.set x=%DATE%
set date=%01%_%01%_%1999%
Call program (arguments)
set date=%x%like that, the proper time is set when "program" has finisched. I want the wrong date only for the instant when "program" is lounched.
Now, all files saved during "program" is running are saved on 01/01/1999!Hope you understood the problem!

Yep, I did.
=====================================
If at first you don't succeed, you're about average.M2

I think file creation dates depend on the system date. Will your application execute using the local var? Will this, or a variation, work for you?
@echo off
cls
setlocalset date=01_01_1999
start applic (arguments)endlocal

Only reason I can see you going thru this exercise is to use a program you can't use anymore because it was date coded to expire.
Technically you can't use this software legally any more if this is the case.

@Valerie
unfortunatly my application seems to use date as a global variable, but thanks for this good idea.
@Wanderer
This is actually the point! I have several versions of this sofware including the actual one with license, but an older version revealed itself to fit best to the problem.probably the problem can be solved with something like this:
start batch1
start batch2**********
batch 1:sleep -m 10
call program (arguments)**********
batch2:set x=%DATE%
set date=%01%_%01%_%1999%
sleep -m 20
set date=%x%1. The sleep comand does not work in xp. How to specify time in ms with "ping localhost -n 7 >nul" ?
2. The process is still not working, any idea?

Process works:
code:
start batch1
start batch2****
batch1:
set saved=%DATE%
Echo 01/01/2004 |Date
ping localhost -n 2 >nul
Echo %saved% |Date*****
batch2
ping localhost -n 1 >nul
call MyApp testX.datThis variation is fine if Myapp is called once. If it has to be called more than one time i have to find another way...
any suggestions?

![]() |
i need major help
|
Active Directory OU listi...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |