Skip to content

Commit e212c69

Browse files
committed
Next major version.
It launches now!
1 parent fe2c41c commit e212c69

File tree

1 file changed

+76
-19
lines changed

1 file changed

+76
-19
lines changed

AutoRunWithCMD.cmd

Lines changed: 76 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
:Init
33
@echo off
44
cls
5-
if copy AutoRunWithCMD.cmd %temp%\AutoRunWithCMD.cmd (
6-
rem Do nothing :)
7-
) else (
8-
echo.Something wen't wrong, please give the error code "4".
9-
)
105
cd %appdata%
116
:: Debug stuff, making a place for logs
127
if exist "Sanikdah Software" (
@@ -29,12 +24,12 @@ if exist "Ease of Use Command Prompt Auto Run Script" (
2924
)
3025
:EoUCPARS-FolderExists
3126
@echo off
32-
if move %temp%\AutoRunWithCMD.cmd "%appdata%\Sanikdah Software\Ease of Use Command Prompt Auto Run Script\AutoRunWithCMD.cmd" 2> nul (
33-
rem Do nothing :)
27+
if exist AutoRunWithCMD.cmd (
28+
copy AutoRunWithCMD.cmd %temp%\AutoRunWithCMD.cmd > nul
3429
) else (
35-
echo. Something went wrong, please give the developer error code "3".
30+
echo.Can't find the this script!!
3631
)
37-
32+
move %temp%\AutoRunWithCMD.cmd "%appdata%\Sanikdah Software\Ease of Use Command Prompt Auto Run Script\AutoRunWithCMD.cmd" > nul
3833
echo.>Launched.txt
3934
goto :ReadBackColor
4035

@@ -49,8 +44,15 @@ goto :MainMenu
4944
:: Launches if the previous code detects that this is your first time launching the program
5045
:FirstTimeUser
5146
@echo off
47+
if exist AutoRunWithCMD.cmd (
48+
copy AutoRunWithCMD.cmd %temp%\AutoRunWithCMD.cmd > nul
49+
) else (
50+
echo.Can't find the this script!!
51+
)
5252
move %temp%\AutoRunWithCMD.cmd "%appdata%\Sanikdah Software\Ease of Use Command Prompt Auto Run Script\AutoRunWithCMD.cmd" > nul
5353
cls
54+
55+
:FirstTimeUser1.5
5456
echo.Hey! Would you like this program to run whenever you launch the command prompt?
5557
echo.(Please note that this is dangerous and will break any other batch script.)
5658
echo.You can ALSO try a safer method, where calling a command in CMD will launch the script.
@@ -66,7 +68,7 @@ if '%doesAutoRun%'=='n' goto :FirstTimeUser2
6668
if '%doesAutoRun%'=='N' goto :FirstTimeUser2
6769
if '%doesAutoRun%'=='S' goto :saferSetAutoRun
6870
if '%doesAutoRun%'=='s' goto :saferSetAutoRun
69-
echo "%doesAutoRun%" is not a valid option, please try again.
71+
echo."%doesAutoRun%" is not valid, please try again.
7072
goto :FirstTimeUser
7173

7274
:: Sets the autoRun value
@@ -78,13 +80,47 @@ if '%isSureOfDangerousAutoRun%'=='Y' goto :setAutoRun2
7880
if '%isSureOfDangerousAutoRun%'=='y' goto :setAutoRun2
7981
if '%isSureOfDangerousAutoRun%'=='n' goto :FirstTimeUser
8082
if '%isSureOfDangerousAutoRun%'=='N' goto :FirstTimeUser
81-
echo "%isSureOfDangerousAutoRun%" is not a valid option, please try again.
83+
echo."%isSureOfDangerousAutoRun%" is not valid, please try again.
84+
goto :setAutoRun
85+
8286
:setAutoRun2
8387
echo.This will NOT work if you have renamed the file.
84-
reg add "HKCU\Software\Microsoft\Command Processor" /v AutoRun ^
85-
/t REG_EXPAND_SZ /d "%appdata%\Sanikdah Software\AutoRunWithCMD.cmd" /f
86-
pause
88+
:goto :setAutoRun2
8789

90+
:saferSetAutoRun
91+
@echo off
92+
echo.This will append the directory of the file to your system PATH, so you can run it with a command.
93+
echo.==WARNING======WARNING=====WARNING===
94+
echo.==WARNING======WARNING=====WARNING===
95+
echo.==WARNING======WARNING=====WARNING===
96+
echo.While I am pretty sure that this is safe, it still messes with your system PATH.
97+
echo.Using IN-DEVELOPMENT CODE.
98+
echo.By aggreeing to add this to your system path, you are aggreeing that your system might not boot afterwards.
99+
echo.Or it might have other side effects, I know for a fact that I made a restore point before doing this.
100+
echo.
101+
echo.S/s: Open the GUI to make a system restore point before attempting this.
102+
echo.C/c: Continue without making a restore point (or if you have already made one).
103+
echo.1: Go back.
104+
set /p choiceForDangerousAutoRun=
105+
if not '%choiceForDangerousAutoRun%'=='' set choiceForDangerousAutoRun=%choiceForDangerousAutoRun:~0,1%
106+
if '%choiceForDangerousAutoRun%'=='s' goto :MakeSystemRestorePoint
107+
if '%choiceForDangerousAutoRun%'=='S' goto :MakeSystemRestorePoint
108+
if '%choiceForDangerousAutoRun%'=='C' goto :saferSetAutoRun2
109+
if '%choiceForDangerousAutoRun%'=='c' goto :saferSetAutoRun2
110+
if '%choiceForDangerousAutoRun%'=='1' goto :FirstTimeUser
111+
echo."%choiceForDangerousAutoRun%" is not valid, please try again.
112+
goto :saferSetAutoRun
113+
114+
:saferSetAutoRun2
115+
@echo off
116+
cls
117+
set AppendToPath='%appdata%\Sanikdah Software\Ease of Use Command Prompt Auto Run Script'
118+
ping techflash.ga -n 2 > nul
119+
:: Wastes time so that the variable 100% has enough time to update
120+
echo.Setting everything...
121+
set "PATH=%AppendToPath%;%PATH%"
122+
echo.Done! Restart your computer for it to work!
123+
goto :MainMenu
88124

89125

90126
@echo off
@@ -177,6 +213,22 @@ ECHO.
177213
goto :Choice
178214
echo.>EndOfChoiceTriggered.txt
179215

216+
:: Some code to launch the restore point UI
217+
:MakeSystemRestorePoint
218+
@echo off
219+
echo.Starting the GUI...
220+
start "" sysdm.cpl
221+
echo.Done!
222+
echo.A few steps now.
223+
echo.1. Click on "System Protection".
224+
echo.1.5 If System Protection is disabled, enable it.
225+
echo.2. Click on "Create".
226+
echo.3. Go through the steps of creating the restore point.
227+
echo.Press any key when you are done.
228+
pause
229+
cls
230+
goto :MainMenu
231+
180232
:Help
181233
@echo off
182234
cls
@@ -233,6 +285,11 @@ set %IP%=
233285
goto :MainMenu
234286

235287
:CheckNetworkStatistics
288+
@echo off
289+
start %windir%\system32\netstat
290+
echo.Press any key to go back to the menu.
291+
pause
292+
goto :MainMenu
236293

237294

238295
:GoToRegularCMD
@@ -297,19 +354,19 @@ echo.Welcome to the settings menu!
297354
echo.Here you can modify some settings!
298355
echo.
299356
echo.1: Modify the default color when you start the script.
300-
echo.2: Set up if you want the script to run automatically, or bind it to a command, or nothing at all.
357+
echo.2: Launch options (load when you start CMD, start when you run a command, or nothing.)
301358
set /p SettingsChoice=
302359
if not '%SetttingsChoice%'=='' set SettingsChoice=%SettingsChoice:~0,1%
303360
if '%SettingsChoice%'=='1' goto :color
304-
if '%SettingsChoice%'=='2' goto :FirstTimeUser
361+
if '%SettingsChoice%'=='2' goto :FirstTimeUser1.5
305362

306363
:: A label used for when I wanted to add an option but it isn't implemented yet or is in a state where it can't be used. Or if I just haven't though of anything to put in that slot yet.
307364
:Nothing
308365
@echo off
309366
echo Nothing here yet! There might be soon O_O
310-
echo. Going back to settings in 5 seconds.
367+
echo. Going back to the main menu in 5 seconds.
311368
timeout 5
312-
goto :Settings
369+
goto :MainMenu
313370

314371
:: A basic section of code for setting the default color of the shell.
315372
:color
@@ -367,4 +424,4 @@ echo.>EndOfExitTriggeredIMPOSSIBLE.txt
367424

368425
:: End of the file, used to end the script (like to go to the normal shell)
369426
:leave
370-
@echo on
427+
@echo on

0 commit comments

Comments
 (0)