Computer Hope

Microsoft => Microsoft DOS => Topic started by: accessman on October 22, 2009, 12:47:41 PM

Title: Batch File To Launch RunAsDate.exe
Post by: accessman on October 22, 2009, 12:47:41 PM
Hi

Somebody please help me!  I need to be able to run the attached, 'RunAsDate.exe' using a batch file(s).  The help file shows how to do this but I cannot get it to work.

RunAsDate.exe {/immediate} {/movetime} [dd\mm\yyyy] {hh:mm:ss} [Program
to run] {Program parameters}

Examples:
RunAsDate.exe 22\10\2002 12:35:22 "C:\Program Files\Microsoft
Office\OFFICE11\OUTLOOK.EXE"
RunAsDate.exe 14\02\2005 "c:\temp\myprogram.exe" param1 param2
RunAsDate.exe /movetime 11\08\2004 16:21:42 "C:\Program Files\Microsoft
Office\OFFICE11\OUTLOOK.EXE"  

My knowledge of DOS/Batch is pretty basic but I have tried all day with this as a line in a batch file, changing various things, searching google etc.  The main sticking point seems to be the date and the variables, but if anyone can help me get this command to work that would be great.  I would need to be able to set and call the dates/parameters from some other file or process as I'm trying to integrate this into an Access based overnight reporting system, and if required the database time needs to be changed without affecting the windows system time.

Many thanks for any help.    ???

[Saving space, attachment deleted by admin]
Title: Re: Batch File To Launch RunAsDate.exe
Post by: Salmon Trout on October 22, 2009, 01:57:34 PM
Maybe you could describe what you are doing, and what errors you are getting, because I just tried it and it worked fine.

I put this line in a batch file and it started Frontpage

Code: [Select]
RunAsDate.exe 22\10\2002 12:35:22 "C:\Program Files\Microsoft Office\Office10\FRONTPG.EXE"
Title: Re: Batch File To Launch RunAsDate.exe
Post by: Geek-9pm on October 22, 2009, 02:13:14 PM
accessman,
Welcome to CH.
Have you read the documentation?
The example you gave is wrong.
Title: Re: Batch File To Launch RunAsDate.exe
Post by: accessman on October 22, 2009, 02:28:17 PM
If I start it with 'RunAsDate.exe' it does nothing.  If I put the whole path to where it is saved inside double quotes, it then seems to get past that to the date as it comes up with a message box saying 'Invalid Date!'.  After clicking OK to the message it then just opens 'RunAsDate.exe' as the program itself.

I did read the documentation but I'm only starting to learn these commands and what I know is very basic.  The examples were just the examples in the readme file.  Maybe I am not reading it right??

To put it all into context, an IT dept have decided they are going to remove admin rights to Windows on the network for all users in the company.  For some people this is probably a good idea but they refuse to have exceptions, which for me is insane.  For most people they won't know any different but our reporting team runs databases overnight and if they crash we still need to be able to change the database time, without touching the windows clock etc. as we will not now be able to.

I hope this helps..

Cheers
Title: Re: Batch File To Launch RunAsDate.exe
Post by: Salmon Trout on October 22, 2009, 03:25:18 PM
Please post EXACTLY what command lines and batch code you are using.
Title: Re: Batch File To Launch RunAsDate.exe
Post by: accessman on October 22, 2009, 03:39:36 PM
At work it's for XP, but Vista at home.  Same problems though.  Now it doesn't even seem to do anything at all.  I'm totally confused.  I put the text below into a text file and changed the extension to make it a .bat file.


"C:\Users\Neil\Documents\_Applications And System\runasdate\RunAsDate.exe" 21\10\2009 15:30:05 "C:\Program Files\Microsoft Office\Office11\EXCEL.EXE"
Title: Re: Batch File To Launch RunAsDate.exe
Post by: accessman on October 22, 2009, 05:47:03 PM
I copied the target from a shortcut created by the program into a new text file, renamed it with .bat and it worked first time.  It has worked every time since as well.  I'm stumped but relieved?!?!  Thanks for the responses anyhow and I hope this thread helps anyone else who needs it.  Doesn't make any sense, but hey it has worked..
Title: Re: Batch File To Launch RunAsDate.exe
Post by: Helpmeh on October 22, 2009, 06:31:54 PM
To put it all into context, an IT dept have decided they are going to remove admin rights to Windows on the network for all users in the company. 
They're in charge of that for a reason. Are you trying to circumvent their authority?

Explain to them this:
Our reporting team runs databases overnight and if they crash we still need to be able to change the database time, without touching the windows clock etc. as we will not now be able to.
If they don't agree, go up the ladder until someone does.
Title: Re: Batch File To Launch RunAsDate.exe
Post by: accessman on October 23, 2009, 12:33:16 PM
Mate, I know and we're laying it all down and presenting issues and options.  Our days of freedom and creativity are being replaced by distant checking and authorisation after a restructure.  We are contractors and the setup is deliberately designed so that in the end we have to just get on with it.  (Wait until a problem affects the bottom line).  It's a recipe for disaster and very difficult to get the seriousness of it across.

It's to administer our own databases when we need to and won't affect Windows itself.  They are being told about it and will hopefully see sense and agree to it.
Title: Re: Batch File To Launch RunAsDate.exe
Post by: Geek-9pm on October 23, 2009, 01:13:01 PM
While you can, now is the time to look into...
 getting a new job somewhere else.
Title: Re: Batch File To Launch RunAsDate.exe
Post by: accessman on October 23, 2009, 01:24:59 PM
Already am...   :)
Title: Re: Batch File To Launch RunAsDate.exe
Post by: Salmon Trout on October 23, 2009, 01:34:50 PM
in the 1980s I knew a guy who ran a circuit simulator on a VAX mini where he worked, they had to set the system date year back to 1986 because the trial period had run out...
Title: Re: Batch File To Launch RunAsDate.exe
Post by: accessman on October 23, 2009, 01:58:50 PM
Nothing like that going on with this.  If it all sounds like b******t it's because it is.  The problem, not the solution I might add..   
Title: Re: Batch File To Launch RunAsDate.exe
Post by: Anjo1077 on March 04, 2013, 01:25:37 PM
I know that is old.
But is unsolved. So the answer is:
Code: [Select]
@ECHO OFF
cd "C:\Users\Neil\Documents\_Applications And System\runasdate\"
RunAsDate.exe /immediate 21\10\2009 15:30:05 "C:\Program Files\Microsoft Office\Office11\EXCEL.EXE"
exit

Past the code on notepad and save as .bat

Tested with:
Windows 7 x64
RunAsDate 1.16 (32 bit)
Title: Re: Batch File To Launch RunAsDate.exe
Post by: patio on March 04, 2013, 03:03:03 PM
I'm speechless...