I haven't learned DOS myself. I'm afraid this can be attributed to the relatively late time I got in touch with computers. Fortunately, I found this great place. How happy I was~~~ And I feel that as long as I come here, I will definitely gain something!
First of all, I've been soaking in the forum for more than half a year. My level is very low, and I approach any problem with a learning attitude. But fortunately, the atmosphere of the whole forum is very good. In addition to the active attitude of the forum members, more importantly, there are a group of enthusiastic and highly skilled moderators here. They can be said to be very good teachers for us. Here, I would like to express my gratitude to the friends who have helped me.
I spent 2 days writing this small program. I mainly wanted to use what I've learned here in one go. Of course, it's a relatively low-level program. I hope you don't laugh at it and give me support.
Please let me know if there are any improper or incorrect places in my writing. I'm very willing to accept suggestions.
Change time: 2006.6.9 10:00
Spent some time in the morning adding comments, which is equivalent to checking the existing problems again by myself. Sure enough, I found a few problems. :P, the attachment hasn't been updated, and there are several problems with upper and lower cases
Change time 2006.6.12 13:00, added inspection of time and date
After writing it on the first day, I felt everything was fine. But after several tests by myself, I found many problems. Now I've changed all the problems I know. Currently, I feel very good (of course, the teachers will definitely find many flaws when they see it, hehe)
There is the one I added a shell to in the attachment, which can be used directly. It feels comparable to the AT command.
[ Last edited by jastyg on 2006-6-12 at 16:09 ]
First of all, I've been soaking in the forum for more than half a year. My level is very low, and I approach any problem with a learning attitude. But fortunately, the atmosphere of the whole forum is very good. In addition to the active attitude of the forum members, more importantly, there are a group of enthusiastic and highly skilled moderators here. They can be said to be very good teachers for us. Here, I would like to express my gratitude to the friends who have helped me.
I spent 2 days writing this small program. I mainly wanted to use what I've learned here in one go. Of course, it's a relatively low-level program. I hope you don't laugh at it and give me support.
Please let me know if there are any improper or incorrect places in my writing. I'm very willing to accept suggestions.
Change time: 2006.6.9 10:00
Spent some time in the morning adding comments, which is equivalent to checking the existing problems again by myself. Sure enough, I found a few problems. :P, the attachment hasn't been updated, and there are several problems with upper and lower cases
Change time 2006.6.12 13:00, added inspection of time and date
==========ETIME========
@echo off
color 1f
echo.
echo Scheduled Plan Tool VER:1.0
echo by: Fengchi Network, jastyg
echo Email:support@efengchi.com
echo HTTP://WWW.EFENGCHI.COM
echo for xp/2k3
echo.
echo.
rem ++++++++++++++++++++Processing in external command line mode+++++++++++++++++++++++++++
rem ===================Check if the external input is empty or is help information============
if "%1!%"=="!" goto guihelp :If the external input is empty, use the graphical page
if "%1%"=="/?" goto help :If the external input is /?, show the DOS help prompt
if "%1%"=="/h" goto help :Same as above, input /h
if "%1%"=="/H" goto help :Same as above, respectively give cases.
for %%i in (0,1,2,3,4,5,6,7,8,9,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31) do if "%1"=="%%i" goto kaishi
goto warng2
rem====================Start setting and checking the external input==================
:kaishi
if "%1"=="0" set d=0&set riqi=0& goto t :If the initial date is 0
set /a tmp=%date:~8,3%+0 >nul :Judge if the date is the 8th or 9th, to connect with the following (method to solve invalid characters of 8 and 9)
cls :Clear screen
if errorlevel 9167 goto tmp1 :Connect with the above to accept if it is the 8th or 9th
goto tmp2
rem====================Determine the date of the 8th and 9th========================
:tmp1
echo %date:~8,2% >tem.txt :Export the current date to a temporary file
find "08" tem.txt >nul :Find whether the value 08 is contained in the temporary file, to connect with the following
if not errorlevel 1 set riqi=8&goto tmp3 :Judge if 08 is contained, then set the riqi variable to 8, jump to TMP3 label
find "09" tem.txt >nul :Find whether the value 09 is contained in the temporary file, to connect with the following
if not errorlevel 1 set riqi=9&goto tmp3 :Judge if 09 is contained, then set the riqi variable to 9, jump to TMP3 label
rem====================Processing when the external date is not 0, 8, 9===============
:tmp2
set /a riqi=%date:~8,2%+0 :Process the case where the tens digit of the date is empty to remove 0
:tmp3
set /a d=%1+0 :Process the case where the tens digit of the user input date is empty to remove 0
rem===================Process the external time and user command=================================
:t
if exist tem.txt del tem.txt :Clean up the temporary file left after setting the date
set t=%2 :Define variable T as the user input time
for %%i in
(0,1,2,3,4,5,6,7,8,9,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,
17,18,19,20,21,22,23,) do if "%t:~0,2%"=="%%i" goto CRC
goto warng2
:CRC
if "%t:~2,1%"==":" goto CRC1
goto warng2
:crc1
for %%i in
(0,1,2,3,4,5,6,7,8,9,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,
17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,
40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,) do if
"%t:~3,2%"=="%%i" goto bcmd
goto warng2
:bcmd
set cmd=%~3 :Define the running program as the user input
if "%~3!"=="!" goto command :If the user doesn't input, jump to the default set value, to COMMAND
goto 4
:command
set cmd=c:\windows\Fengchi Backup.bat :Set the default running command
rem===================Set external loop option command==========================================
:4
if "%4!%"=="!" goto 41 :Judge if it is empty and jump relatively
if "%4%"=="n" goto 41 :Judge if it is lowercase n and jump relatively
if "%4%"=="N" goto 41 :Whether it is uppercase N and jump relatively
if "%4%"=="y" goto 42 :Whether it is lowercase y and jump relatively
if "%4%"=="Y" goto 42 :Whether it is uppercase Y and jump relatively
rem===================Set default and no loop==============================================
:41
set rem=echo. :Define variable as echo.
goto start :Jump to the part of checking date and time
:42
set rem=goto start :Define variable as goto statement, realize loop
set yanchi=ping -n 60 127.1^>nul :To prevent the time from running multiple times within the specified time, set a delay of 1 minute
goto start :Jump to the part of checking date and time
echo.
rem ++++++++++++++++++++Graphical setting and configuration processing++++++++++++++++++++++++++++++++++++++++
rem===================Graphical help prompt================================================
:guihelp
echo Please wait......
ping -n 1 ping 127.1 >nul
cls
echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo +Usage 1: Directly run this file and follow the wizard. Enter? or h for help +
echo +Date format: For example, 9th, you can enter 9 or 09 +
echo +Time format adopts 24-hour system, that is: 20:50 (precision to minutes) +
echo +Usage 2: Command line mode; +
echo +Syntax: etime day time command (it's better to write the full path) Y/N (whether to run in loop, default is N) +
echo +Example: etime 7 20:20 notepad.exe (Run the NOTEPAD program at 20:20 on the 7th, and don't loop) +
echo +Example: etime 0 20:20 notepad.exe Y (Run the NOTEPAD program at 20:20, and loop) +
echo +Enter etime /? or etime /h in DOS to get help +
echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
rem===================Detect and define the user input date==================================
:begin
echo Please enter date
set d1=enter :Define a value for D1, to detect if the user input is empty in the following
set /p d1= :User-defined input
if "%d1%"=="?" goto guihelp :Call graphical help
if "%d1%"=="h" goto guihelp :Same as above
if "%d1%"=="H" goto guihelp :Same as above
if "%d1%"=="enter" goto warng :Detect if the user input is empty, and process relatively
if "%d1%"=="0" set d=0&set riqi=0& goto shij :Detect if the user input is 0, and relatively define
for %%i in(0,1,2,3,4,5,6,7,8,9,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,
17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,?,h,H,) do if "%
d1%"=="%%i" goto 89
goto warng
:89
set /a tmp=%date:~8,3%+0 >nul :Judge if the date is the 8th or 9th, to connect with the following (method to solve invalid characters of 8 and 9)
cls
if errorlevel 9167 goto tem1 :Connect with the above to accept if it is the 8th or 9th, and jump relatively
goto tem2
rem====================Determine the date of the 8th and 9th, same as TMP1========================
:tem1
echo %date:~8,2% >tem.txt
find "08" tem.txt >nul
if not errorlevel 1 set riqi=8&goto tem3
find "09" tem.txt >nul
if not errorlevel 1 set riqi=9&goto tem3
rem====================Processing when the date is not 0, 8, 9, same as TMP2===============
:tem2
set /a riqi=%date:~8,2%+0
:tem3
set /a d=%d1%+0
rem===================Process time and user command=================================
:shij
if exist tem.txt del tem.txt :Clean up the temporary file left after setting the date
cls
echo Please enter time
set t=enter :Define a value for T, to detect if the user input is empty in the following
set /p t= :User-defined input
if "%t%"=="?" goto guihelp :Call graphical help
if "%t%"=="h" goto guihelp :Same as above
if "%t%"=="H" goto guihelp :Same as above
if "%t%"=="enter" goto warng1 :Detect if the user input is empty, and process relatively
for %%i in
(0,1,2,3,4,5,6,7,8,9,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,
17,18,19,20,21,22,23,?,h,H) do if "%t:~0,2%"=="%%i" goto TCRC
goto warng1
:TCRC
if "%t:~2,1%"==":" goto TCRC1
goto warng1
:tcrc1
for %%i in
(0,1,2,3,4,5,6,7,8,9,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,
17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,
40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,) do if
"%t:~3,2%"=="%%i" goto cmd
goto warng1
rem==================Process user command===========================================
:cmd
echo Please enter the path and file name of the file to be executed
set cmd=enter
set /p cmd=
if "%cmd%"=="?" goto guihelp
if "%cmd%"=="h" goto guihelp
if "%cmd%"=="H" goto guihelp
if "%cmd%"=="enter" goto command1
goto xunhuan
:command1
set cmd=c:\windows\Fengchi Backup.bat
rem==================Define whether to loop================================================
:xunhuan
echo Whether to run in loop? Y/N
set rem=enter
set /p rem=
if "%rem%"=="y" goto 14
if "%rem%"=="Y" goto 14
if "%rem%"=="enter" goto 24
if "%rem%"=="n" goto 24
if "%rem%"=="N" goto 24
:14
set rem=goto start
set yanchi=ping -n 60 127.1^>nul
goto start
:24
set rem=rem goto
cls
rem==================Detection and relative processing of current date time and user input date time========================
:start
if "%riqi%%time:~0,5%"=="%d% %t%" goto run
ping -n 15 127.1>nul
rem==================DOS help prompt=======================================================
:help
chcp 936 >nul
echo Syntax: etime day time command (it's better to write the full path) Y/N (whether to run in loop, default is N)
echo Example: etime 7 20:20 notepad.exe (Run the NOTEPAD program at 20:20 on the 7th, and don't loop)
echo Example: etime 7 20:20 "del c:\aaa.txt" (Delete a specific file at the specified time)
echo Example: etime 0 20:20 notepad.exe Y (Run the NOTEPAD program at 20:20, and loop)
echo Enter etime /? or etime /h in DOS to get help
goto exit
rem==================Input error prompt==========================================================
:warng
echo Your date input is incorrect!
echo.
goto begin
rem==================Input error prompt==========================================================
:warng1
echo Your time input is incorrect!
echo.
goto shij
rem==================Execute user-defined command or default command, and whether to loop==============================
:run
cls
start %cmd% :Execute command
%yanchi% :Delay time connects with the above to prevent multiple runs of the command
%rem% :Define whether to loop
exit :Program ends
rem==================Exit to the prompt=========================================================
:warng2
echo Syntax error!!
:exit
After writing it on the first day, I felt everything was fine. But after several tests by myself, I found many problems. Now I've changed all the problems I know. Currently, I feel very good (of course, the teachers will definitely find many flaws when they see it, hehe)
There is the one I added a shell to in the attachment, which can be used directly. It feels comparable to the AT command.
[ Last edited by jastyg on 2006-6-12 at 16:09 ]
Attachments
