I made a batch file to learn all about the network you are on, as well as trace/ping ip addresses and websites.
Any suggestion for improvement?
All About The Network
Moderator: DosItHelp
-
- Posts: 8
- Joined: 12 May 2017 06:49
- Contact:
All About The Network
- Attachments
-
- Everything About The Network.zip
- (902 Bytes) Downloaded 390 times
Re: All About The Network
Lots of bad practices here. Also, there are much simpler ways of getting all of the information without being prompted many times over...
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: All About The Network
I don't know if I'd say lots of bad practices, but there is a significant amount of redundant code.
Also, this is just personal preference, but there's never any reason to ever use mode 1000 IMO, especially if none of the commands need that much horizontal space. Also personal preference, spaces don't belong in file names. I know they work fine, but they mean that I have to put paths in quotes when I call files and I'm too lazy to hit " twice.
Choice would be better to use than set /p for user input, or at least include a default case where the user enters something you didn't expect. Also, use quotes on both sides of an if statement in case the user enters nothing.
I appreciate that you've planned for a scenario where you want some diagnostics to get redirected to a text file and other diagnostics to simply be displayed on the screen, even though I can't imagine this ever happening in real life.
If you put a cls immediately after :choices instead of using cls & goto :choices, you could significantly shrink the file size.
Finally, obligatory "comment your code" comment.
I've written my own version that I think you might find interesting.
Also, this is just personal preference, but there's never any reason to ever use mode 1000 IMO, especially if none of the commands need that much horizontal space. Also personal preference, spaces don't belong in file names. I know they work fine, but they mean that I have to put paths in quotes when I call files and I'm too lazy to hit " twice.
Choice would be better to use than set /p for user input, or at least include a default case where the user enters something you didn't expect. Also, use quotes on both sides of an if statement in case the user enters nothing.
Code: Select all
if "%colnumber%" == "1" goto color0a
I appreciate that you've planned for a scenario where you want some diagnostics to get redirected to a text file and other diagnostics to simply be displayed on the screen, even though I can't imagine this ever happening in real life.
If you put a cls immediately after :choices instead of using cls & goto :choices, you could significantly shrink the file size.
Finally, obligatory "comment your code" comment.
I've written my own version that I think you might find interesting.
- Attachments
-
- netinfo.zip
- (1.35 KiB) Downloaded 360 times
-
- Posts: 8
- Joined: 12 May 2017 06:49
- Contact:
Re: All About The Network
ShadowThief wrote:I don't know if I'd say lots of bad practices, but there is a significant amount of redundant code.
Also, this is just personal preference, but there's never any reason to ever use mode 1000 IMO, especially if none of the commands need that much horizontal space. Also personal preference, spaces don't belong in file names. I know they work fine, but they mean that I have to put paths in quotes when I call files and I'm too lazy to hit " twice.
Choice would be better to use than set /p for user input, or at least include a default case where the user enters something you didn't expect. Also, use quotes on both sides of an if statement in case the user enters nothing.Code: Select all
if "%colnumber%" == "1" goto color0a
I appreciate that you've planned for a scenario where you want some diagnostics to get redirected to a text file and other diagnostics to simply be displayed on the screen, even though I can't imagine this ever happening in real life.
If you put a cls immediately after :choices instead of using cls & goto :choices, you could significantly shrink the file size.
Finally, obligatory "comment your code" comment.
I've written my own version that I think you might find interesting.
Thank you for looking at it. I am thankful that people even look at my files to be honest. Sorry I wasn't able to respond sooner, because I haven't had internet for a while. I'll check it out. I can't say this enough, but I am so happy that there are still people out there that use actual constructive criticism.
EDIT: Also I can't open it because the zip is password protected.
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: All About The Network
goodorbadash wrote:EDIT: Also I can't open it because the zip is password protected.
I have no idea how that happened
Try it now.
- Attachments
-
- netinfo.zip
- (3.52 KiB) Downloaded 311 times
-
- Posts: 8
- Joined: 12 May 2017 06:49
- Contact:
Re: All About The Network
ShadowThief wrote:goodorbadash wrote:EDIT: Also I can't open it because the zip is password protected.
I have no idea how that happened
Try it now.
Thank you. I have tried it out, and I am gonna say this right now...
IT IS LIKE 200% BETTER THAN MINE!
Seriously. It's awesome.