![Image](http://i.imgur.com/EMaRr.gif)
I'm looking for a batch script that would schedule a task to start 40 days from now (so, it is a relative date).
It should be language independent and compatible with XP/Vista/2008/7, x86 and x64.
Any help would be greatly appreciated!
![Image](http://i.imgur.com/jg2t4.gif)
Moderator: DosItHelp
Code: Select all
:: Date foward & backward
@echo off
:: from code by Phil Robyn
setlocal
if [%1]==[] (
echo to get todays date use
echo call "%~n0" today 0
echo.
echo to get yesterdays date use
echo call "%~n0" today -1
echo.
echo to get the date 25 days ago:
echo call "%~n0" today -25
echo.
echo to get the date 1250 days in the future
echo call "%~n0" today +1250
goto :EOF)
set date1=%1
set qty=%2
if /i "%date1%" EQU "TODAY" (
set date1=now
) else (
set date1="%date1%"
)
echo >"%temp%\%~n0.vbs" s=DateAdd("d",%qty%,%date1%)
echo>>"%temp%\%~n0.vbs" WScript.Echo year(s)^&_
echo>>"%temp%\%~n0.vbs" right(100+month(s),2)^&_
echo>>"%temp%\%~n0.vbs" right(100+day(s),2)
for /f %%a in (
'cscript //nologo "%temp%\%~n0.vbs"') do set result=%%a
del "%temp%\%~n0.vbs"
endlocal& set day=%result:~0,4%-%result:~4,2%-%result:~6,2%
echo %%day%% is set to "%day%" (without the quotes)
Code: Select all
StdDate > NUL
set /A future=%errorlevel%+40
StdDate %future%
Aacini wrote:You may use my StdDate.exe program to get the future date in a very easy way:Code: Select all
StdDate > NUL
set /A future=%errorlevel%+40
StdDate %future%
Code: Select all
>dir
Volume in drive C has no label.
Volume Serial Number is CCA1-5338
Directory of C:\Documents and Settings\Antonio\My Documents\ASMB\Batch File Programming\tests\test
09/07/2012 05:20 p.m. <DIR> .
09/07/2012 05:20 p.m. <DIR> ..
09/07/2012 05:21 p.m. 686 HexChar.vbs
09/07/2012 05:20 p.m. 515 HexToBin.bat
09/07/2012 05:18 p.m. 2,881 StdDate.exe.hex
3 File(s) 4,082 bytes
2 Dir(s) 1,856,012,288 bytes free
C:\Documents and Settings\Antonio\My Documents\ASMB\Batch File Programming\tests\test
>hextobin StdDate.exe.hex
StdDate.exe file created
C:\Documents and Settings\Antonio\My Documents\ASMB\Batch File Programming\tests\test
>dir
Volume in drive C has no label.
Volume Serial Number is CCA1-5338
Directory of C:\Documents and Settings\Antonio\My Documents\ASMB\Batch File Programming\tests\test
09/07/2012 05:21 p.m. <DIR> .
09/07/2012 05:21 p.m. <DIR> ..
09/07/2012 05:21 p.m. 686 HexChar.vbs
09/07/2012 05:20 p.m. 515 HexToBin.bat
09/07/2012 05:21 p.m. 3,072 StdDate.exe
09/07/2012 05:18 p.m. 2,881 StdDate.exe.hex
4 File(s) 7,154 bytes
2 Dir(s) 1,856,008,192 bytes free
david.lynch wrote:... how could I set a variable with StdDate result on the same batch?
Code: Select all
StdDate > NUL
set /A future=%errorlevel%+40
for /F %%a in ('StdDate %future%') do set futureDate=%%a
foxidrive wrote:... you're making it hard for people to use all your tools.
Aacini wrote:NOTE: If you want to convert a filename.exe.hex file to filename.exe, just copy both HexToBin.bat and HexChar.vbs files below, and type: hextobin filename.exe.hex
foxidrive wrote:Aacini, you could have a single post with one batch file that creates all your utilities...
I suggested this before and you ignored me: I know that it's a PITA trying to extract the information for one tool...
After all - this is a batch file site and we use batch file to make our tasks easier. What better way is there to create all your tools in one hit?
Aacini wrote:David just misread the beginning of the explanation about how to create my .exe auxiliary programs:
Aacini wrote:What is needed is an index at the beginning of that topic so people may quickly browse the auxiliary programs and easily locate the specific one(s) they wants. I will post that index soon.
Aacini wrote:That is precisely the opposite point of view of my program design! If you read my previous, old posts, perhaps you remember that I started these utilities with small .com executable files of a couple hundred bytes sizes. When I was forced to write Win32 .exe executable files, I complained about the new size of the same programs, about 1500-2000 bytes. Why is small size an important point here? Because Batch file execution is SLOW! If the auxiliary program is large, then Batch programs like Mandelbrot Set in color or the animated game Snake, that execute the auxiliary file hundred or thousand times, would be just too slow to be useful...
EDIT: As a matter of fact, in my opinion the only way that Batch may achieve some tasks normally deserved to any other real programming language is by trying to write Batch programs that run in the fastest possible way, and the only way to do that with additional Batch features is via the smallest possible auxiliary files!
Squashman wrote:Well Swiss File Knife is so small it fits on a Floppy Disk and has about 90 utilities built-in to it. And it is wicked fast at doing some of the Large Data Processing I need it to do. I used to have a pure batch solution for appending data to the end of each line in very large text files. Pure batch was extremely slow but SFK was super fast at doing it.
I was just making an observation based on my experience with another piece of software.