Code: Select all
:START
PING -n 60 127.0.0.1 > NUL
SET CURTIME=%TIME:~0,-6%
IF NOT "%CURTIME%"=="10:00" GOTO START
CODE TO EXECUTE
Moderator: DosItHelp
Code: Select all
:START
PING -n 60 127.0.0.1 > NUL
SET CURTIME=%TIME:~0,-6%
IF NOT "%CURTIME%"=="10:00" GOTO START
CODE TO EXECUTE
Code: Select all
@if (true == false) then /*
@echo off
%SystemRoot%\system32\cscript.exe //E:JScript "%~f0" "10:00"
:: code to execute
goto :eof
*/
@end
if (WScript.Arguments.Unnamed.Length > 0) {
var wait = WScript.Arguments.Unnamed.Item (0);
var date = new Date ();
var until = new Date (date.getYear (), date.getMonth (), date.getDate () , parseInt (wait.substring (0,2)), parseInt (wait.substring (3,5)), 0,0);
var diff = 0;
// EDIT: added this line to do the same as in the above batch:
// EDIT 2: corrected the line...
if ((until.getTime () - date.getTime ()) < 0) until.setDate (until.getDate () + 1);
do { // maybe this program may be waked up by some security manager, so loop
date = new Date ();
diff = until.getTime () - date.getTime ();
WScript.sleep (diff);
} while (diff > 0)
}
Code: Select all
@echo off
setlocal
for /f "tokens=2* delims=:" %%a in ('%SystemRoot%\system32\find /C "#" "%~f0"') do set /a "lines=%%b"
for /f "tokens=2* delims=:" %%a in ('%SystemRoot%\system32\find /C /V "#" "%~f0"') do set /a "lines+=%%b"
for /f "tokens=1,* delims=:" %%a in ('findstr /N /R /C:"^:: delete up to this line.*" "%~f0"') do (
set /a "from=%%a"
goto :next
)
:next
setlocal enableDelayedExpansion
(
for /l %%a in (1,1,%lines%) do (
set "INPUT="
set /p "INPUT="
if %%a GTR %from% (
if defined INPUT (
set "INPUT=!INPUT:findstr=%%SystemRoot%%\system32\findstr!"
set "INPUT=!INPUT:xcopy=%%SystemRoot%%\system32\xcopy!"
echo(!INPUT!
) else (
echo(
)
)
)
)< "%~f0" > "%~f0.bat"
endlocal
goto:eof
(
del "%~f0"
move "%~f0.bat" "%~f0"
exit /b 0
)
:: delete up to this line
:: findstr !
:: xcopy !
Gotcha. Makes sense.penpen wrote:Definitely that.
If you don't exactly specify which executable to run, someone may execute his exe file instead of yours, with your rights as you call it.
This was my thinking as well. It really depends on how secure the execution is going to be. This is on a locked server sitting in a closet by itself. No one can even execute commands from the command line.foxidrive wrote:That's true - but think of all the other tools that you would also have to prepend the path.
find, findstr, xcopy, robocopy, and scads more external commands.
I actually just found out about that, but it's still a windows service. I wanted something a lot more command-line based.Squashman wrote:AT is still supported. Why not use that?