All About The Network

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
goodorbadash
Posts: 8
Joined: 12 May 2017 06:49
Contact:

All About The Network

#1 Post by goodorbadash » 25 May 2017 07:17

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? :D
Attachments
Everything About The Network.zip
(902 Bytes) Downloaded 345 times

SIMMS7400
Posts: 541
Joined: 07 Jan 2016 07:47

Re: All About The Network

#2 Post by SIMMS7400 » 06 Jun 2017 04:47

Lots of bad practices here. Also, there are much simpler ways of getting all of the information without being prompted many times over...

ShadowThief
Expert
Posts: 1162
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: All About The Network

#3 Post by ShadowThief » 06 Jun 2017 15:52

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.
Attachments
netinfo.zip
(1.35 KiB) Downloaded 316 times

goodorbadash
Posts: 8
Joined: 12 May 2017 06:49
Contact:

Re: All About The Network

#4 Post by goodorbadash » 11 Jul 2017 12:11

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. :D

EDIT: Also I can't open it because the zip is password protected.

ShadowThief
Expert
Posts: 1162
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: All About The Network

#5 Post by ShadowThief » 11 Jul 2017 15:20

goodorbadash wrote:EDIT: Also I can't open it because the zip is password protected.


I have no idea how that happened :oops:

Try it now.
Attachments
netinfo.zip
(3.52 KiB) Downloaded 256 times

goodorbadash
Posts: 8
Joined: 12 May 2017 06:49
Contact:

Re: All About The Network

#6 Post by goodorbadash » 12 Jul 2017 01:59

ShadowThief wrote:
goodorbadash wrote:EDIT: Also I can't open it because the zip is password protected.


I have no idea how that happened :oops:

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! :( :shock: :lol:

Seriously. It's awesome.

Post Reply