Computing.Net > Forums > Windows XP > Pc Date control within batchfile

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Pc Date control within batchfile

Reply to Message Icon

Name: furiouslin
Date: May 29, 2009 at 08:50:50 Pacific
OS: Windows XP SP2
CPU/Ram: intel
Subcategory: General
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: May 29, 2009 at 09:15:39 Pacific
Reply:

Didn't we go through this a couple days ago?


=====================================
If at first you don't succeed, you're about average.

M2


0

Response Number 2
Name: furiouslin
Date: May 29, 2009 at 12:50:27 Pacific
Reply:

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.


0

Response Number 3
Name: Mechanix2Go
Date: May 29, 2009 at 13:01:53 Pacific
Reply:

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


0

Response Number 4
Name: furiouslin
Date: May 29, 2009 at 14:19:25 Pacific
Reply:

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!


0

Response Number 5
Name: Mechanix2Go
Date: May 29, 2009 at 14:41:34 Pacific
Reply:

Yep, I did.


=====================================
If at first you don't succeed, you're about average.

M2


0

Related Posts

See More



Response Number 6
Name: Valerie (by Garibaldi)
Date: May 29, 2009 at 14:52:30 Pacific
Reply:

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
setlocal

set date=01_01_1999
start applic (arguments)

endlocal


0

Response Number 7
Name: wanderer
Date: May 29, 2009 at 16:31:50 Pacific
Reply:

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.


0

Response Number 8
Name: furiouslin
Date: June 2, 2009 at 22:56:05 Pacific
Reply:

@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?


0

Response Number 9
Name: furiouslin
Date: June 2, 2009 at 23:13:38 Pacific
Reply:

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.dat

This 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?


0

Sponsored Link
Ads by Google
Reply to Message Icon

i need major help Active Directory OU listi...



Post Locked

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


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: Pc Date control within batchfile

pc remote control in Xp www.computing.net/answers/windows-xp/pc-remote-control-in-xp-/18930.html

PC remote control through firewall www.computing.net/answers/windows-xp/pc-remote-control-through-firewall/123968.html

VPN securities ?'s www.computing.net/answers/windows-xp/vpn-securities-s/163191.html