Skip to content

Commit 70c0421

Browse files
committed
A **LOT** of changes, including a (mostly) functional Log file now.
1 parent 5aa225a commit 70c0421

File tree

1 file changed

+58
-9
lines changed

1 file changed

+58
-9
lines changed

AutoRunWithCMD.cmd

Lines changed: 58 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
@echo off
44
cls
55
cd %appdata%
6-
set blank=''
6+
set blank=
77
:: Debug stuff, making a place for logs
88
if exist "Sanikdah Software" (
99
cd "Sanikdah Software".
@@ -30,8 +30,18 @@ if exist AutoRunWithCMD.cmd (
3030
) else (
3131
echo.Can't find the this script!!
3232
)
33+
34+
if exist Log.txt.old (
35+
del /f Log.txt.old
36+
)
37+
:: Rename the log to Log.txt.old
38+
if exist Log.txt (
39+
ren Log.txt Log.txt.old
40+
)
3341
move %temp%\AutoRunWithCMD.cmd "%appdata%\Sanikdah Software\Ease of Use Command Prompt Auto Run Script\AutoRunWithCMD.cmd" > nul
34-
echo.>Launched.txt
42+
for /F "tokens=2" %%i in ('date /t') do set mydate=%%i
43+
set mytime=%time%
44+
echo %mydate%:%mytime% Started the program > Log.txt
3545
goto :ReadBackColor
3646

3747
:ReadBackColor
@@ -319,7 +329,7 @@ goto :Help
319329
@echo off
320330
cls
321331
echo.
322-
title Liiiiinkks....
332+
title Links
323333
echo. 1: Back
324334
echo. 2: GitHub repository for this project
325335
echo. 3: Developer's website (not garrunteed to be up)
@@ -346,11 +356,12 @@ goto :Links
346356
@echo off
347357
title Please wait....
348358
echo Getting your IP....
349-
curl ip.me > TempIP.txt
359+
curl ip.me -s > TempIP.txt
350360
set /p IP= < TempIP.txt
351-
del TempIP.txt
361+
cls
352362
echo Your public IP is %IP%!
353363
set %IP%='%blank%'
364+
del TempIP.txt
354365
goto :MainMenu
355366

356367
:CheckNetworkStatistics
@@ -366,18 +377,23 @@ goto :MainMenu
366377
@echo off
367378
title Command Prompt
368379
goto :leave
369-
echo.>EndOfGoToRegualarCMDTriggered.txt
380+
for /F "tokens=2" %%i in ('date /t') do set mydate=%%i
381+
set mytime=%time%
382+
echo.%mydate%:%mytime% ERROR End of GoToRegularCMD triggered!!! > Log.txt
370383

371384
:PingGoogle
372385
@echo off
373386
title Pinging Google......
374-
ping google.com -n 1 >PingStats.txt
387+
ping google.com -n 1 > PingStats.txt
375388
if %errorlevel%==0 (set InternetState=up) else (set InternetState=down)
376389
cls
377390
echo.
378391
echo.Internet is %InternetState%!
392+
del /f PingStats.txt
379393
goto :MainMenu
380-
echo.>EndOfPingGoogleTriggered.txt
394+
for /F "tokens=2" %%i in ('date /t') do set mydate=%%i
395+
set mytime=%time%
396+
echo.%mydate%:%mytime% ERROR End of PingGoogle triggered!!! > Log.txt
381397

382398

383399
::Debug options, to be accessible by those who know exactly what they are doing
@@ -504,9 +520,42 @@ goto :Init
504520
:: Simplest one of them all, exits the shell
505521
:exit
506522
exit
507-
echo.>EndOfExitTriggeredIMPOSSIBLE.txt
523+
echo
508524

509525

510526
:: End of the file, used to end the script (like to go to the normal shell)
511527
:leave
528+
@echo off
529+
echo.THIS IS BROKEN, YOU **LIKELY** DO NOT HAVE ERRORS, AND THIS ONLY SENDS THE FIRST LINE OF THE LOG!!!!
530+
findstr /c:"ERROR" log.txt > isHaveErrors.txt
531+
set /p isHaveError= < isHaveErrors.txt
532+
::del /f isHaveErrors.txt
533+
if not "%isHaveError%"=="" (
534+
copy Log.txt Log.send > nul
535+
echo.Errors were found in your log file, do you want
536+
echo.to send the log file to the developer to diagnose the issue?
537+
set /p sendLogChoice=
538+
if not '%sendLogChoice%'=='' set sendLogChoice=%sendLogChoice:~0,1%
539+
if '%sendLogChoice%'=='y' goto :SubmitLogFile
540+
if '%sendLogChoice%'=='Y' goto :SubmitLogFile
541+
if '%sendLogChoice%'=='n' goto :realLeave
542+
if '%sendLogChoice%'=='N' goto :realLeave
543+
ECHO. "%sendLogChoice%" is not a valid option, please try again.
544+
goto :leave
545+
)
546+
else (
547+
goto :realLeave
548+
)
549+
:SubmitLogFile
550+
@echo off
551+
set /p Log= < Log.send
552+
echo.%Log%
553+
echo.Email that I can reach you at if required? OPTIONAL
554+
set /p emailForLog=
555+
echo.Sending the log...
556+
curl -X POST -d program=AutoRunCMD -d email=%emailForLog% -d "logData=%Log%" https://techflash.ga/saveLogsFromPrograms
557+
echo.Done! Please wait for the developer to review your log, and reach out to you via email if necessary.
558+
echo.No clue if it actually sent though, if I don't respond within 48 hours, please reach out and ask if I recieved it or not.
559+
echo.If you need to reach me, ask on my Discord server, or email me.
560+
:realLeave
512561
@echo on

0 commit comments

Comments
 (0)