Skip to content

Commit bc84f49

Browse files
committed
v1.1
1 parent 728d44a commit bc84f49

3 files changed

Lines changed: 48 additions & 3 deletions

File tree

Changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# DSBS Changelog
2+
- v1.1
3+
Added Command Line Arguments
4+
Bug fixes
5+
6+
- v1.0
7+
Initial Release

DisableSearchBoxSuggestions/Program.cs

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Diagnostics;
3+
using System.IO;
34
using System.Security.Principal;
45
using System.Threading;
56
using Microsoft.Win32;
@@ -8,8 +9,9 @@ namespace DisableSearchBoxSuggestions
89
{
910
internal class Program
1011
{
11-
public static string version = "1.0";
12+
public static string version = "1.1";
1213
public static string githubLink = "https://github.com/KilLo445/DisableSearchBoxSuggestions";
14+
public static string changeLink = "https://github.com/KilLo445/DisableSearchBoxSuggestions/blob/main/Changelog.md";
1315

1416
public static string asciiArt = $@"
1517
,---, .--.--. ,---,. .--.--.
@@ -49,12 +51,23 @@ static void Main(string[] args)
4951
Console.WriteLine();
5052
Console.WriteLine("--------------------------------------------------");
5153
Console.WriteLine();
54+
foreach (string arg in Environment.GetCommandLineArgs())
55+
{
56+
if (arg == "-h" || arg == "-help") { Help(); PressAnyKeyToExit(); }
57+
if (arg == "-1" || arg == "-d" || arg == "-dsbs") { DSBS(); PressAnyKeyToExit(); }
58+
if (arg == "-2" || arg == "-e" || arg == "-esbs") { ESBS(); PressAnyKeyToExit(); }
59+
if (arg == "-3" || arg == "-a" || arg == "-about") { AboutDSBS(); PressAnyKeyToExit(); }
60+
if (arg == "-4" || arg == "-g" || arg == "-github") { Console.WriteLine("Opening GitHub..."); Process.Start(githubLink); PressAnyKeyToExit(); }
61+
if (arg == "-5" || arg == "-c" || arg == "-changes" || arg == "-changelog") { Console.WriteLine("Opening Changelog..."); Process.Start(changeLink); PressAnyKeyToExit(); }
62+
if (arg == "-v" || arg == "-ver" || arg == "-version") { Console.WriteLine($"You have v{version} installed"); PressAnyKeyToExit(); }
63+
}
5264
Console.WriteLine("What would you like to do?");
5365
Console.WriteLine();
5466
Console.WriteLine("[1] Disable Search Box Suggestions");
5567
Console.WriteLine("[2] Enable Search Box Suggestions");
5668
Console.WriteLine("[3] About DSBS");
5769
Console.WriteLine("[4] Open DSBS GitHub");
70+
Console.WriteLine("[5] Open DSBS Changelog");
5871
Console.WriteLine();
5972
Console.Write("Enter choice: ");
6073
string userInput = Console.ReadLine();
@@ -64,11 +77,25 @@ static void Main(string[] args)
6477
if (userInput == "1") { DSBS(); PressAnyKeyToExit(); }
6578
if (userInput == "2") { ESBS(); PressAnyKeyToExit(); }
6679
if (userInput == "3") { AboutDSBS(); PressAnyKeyToExit(); }
67-
if (userInput == "4") { Console.WriteLine("Opening GitHub link..."); Process.Start(githubLink); }
68-
if (userInput != "1" || userInput != "2" || userInput != "3" || userInput != "4") { Console.WriteLine("Unknown command..."); PressAnyKeyToExit(); }
80+
if (userInput == "4") { Console.WriteLine("Opening GitHub..."); Process.Start(githubLink); PressAnyKeyToExit(); }
81+
if (userInput == "5") { Console.WriteLine("Opening Changelog..."); Process.Start(changeLink); PressAnyKeyToExit(); }
82+
if (userInput != "1" || userInput != "2" || userInput != "3" || userInput != "4" || userInput != "5") { Console.WriteLine("Unknown command..."); PressAnyKeyToExit(); }
6983
PressAnyKeyToExit();
7084
}
7185

86+
public static void Help()
87+
{
88+
Console.WriteLine("-help - Opens this");
89+
Console.WriteLine("-github - Opens GitHub page");
90+
Console.WriteLine("-dsbs - Disable Search Box Suggestions");
91+
Console.WriteLine("-esbs - Enable Search Box Suggestions");
92+
Console.WriteLine("-about - About DSBS");
93+
Console.WriteLine("-changelog - Open Changelog");
94+
Console.WriteLine("-version - Shows installed version");
95+
Console.WriteLine();
96+
Console.WriteLine("These also work with the first letter of each arg, -d, -e, etc, or with the numeric option.");
97+
}
98+
7299
public static void DSBS()
73100
{
74101
Console.WriteLine("Checking for permission...");
@@ -89,6 +116,14 @@ public static void DSBS()
89116
RegistryKey keyWin = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Policies\Microsoft\Windows\Explorer");
90117
Console.WriteLine("Key created! Closing registry...");
91118
keyWin.Close();
119+
Thread.Sleep(100);
120+
Console.WriteLine("Restarting...");
121+
Thread.Sleep(200);
122+
Process dsbs = new Process();
123+
dsbs.StartInfo.FileName = Path.Combine(Directory.GetCurrentDirectory()) + "\\" + "DisableSearchBoxSuggestions.exe";
124+
dsbs.StartInfo.Arguments = " -dsbs";
125+
dsbs.Start();
126+
Environment.Exit(0);
92127
}
93128
catch (Exception e) { ExceptionMSG(e); }
94129
}

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<ul>
3636
<li><a href="#prerequisites">Prerequisites</a></li>
3737
<li><a href="#installation">Installation</a></li>
38+
<li><a href="#arguments">Arguments</a></li>
3839
</ul>
3940
</li>
4041
<li><a href="#license">License</a></li>
@@ -84,6 +85,8 @@ Built for Windows 11, untested on Windows 10
8485
4. Run it
8586
5. Select mode
8687

88+
### Arguments
89+
- -help `Displays all available command line arguments`
8790

8891
<!-- LICENSE -->
8992
## License

0 commit comments

Comments
 (0)