Hi,
I am a total newbie with programming batch files, so I wonder if it is posible to have a batch file that opens a file in my computer at a specific time, like
c:\infoBet.accdb ' I would like this file to be open 2 minutes after the batch is executed
I appreciatte your help
open file at a specific time
Moderator: DosItHelp
Re: open file at a specific time
You may use the TIMEOUT command which suspends the batch execution for the specified number of seconds.
Steffen
Steffen
Re: open file at a specific time
That works great, thank you
Since it is related to the same question, can I apart from the timeout set another parameter, that the timeout should only start counting if the is NOT between 02 AM and 5 AM?
Since it is related to the same question, can I apart from the timeout set another parameter, that the timeout should only start counting if the is NOT between 02 AM and 5 AM?
Re: open file at a specific time
You could extract time information using for- and wmic-command and then check if you are not within 2 and 5 am
Sidenote: You could instead use your environment variable "time" for that purpose, but as that is localized i don't know the exact format on your system.
penpen
Code: Select all
@echo off
setlocal enableExtensions enableDelayedExpansion
set "stamp="
for /f "skip=1 delims=.," %%a in ('wmic os get localDateTime') do if not defined stamp set "stamp=%%~a"
set /a "stamp=1%stamp:~8%-1000000"
if %stamp% lss 20000 rem: your timeout cmd
if %stamp% gtr 50000 rem: your timeout cmd
:: rest of your code
penpen