How can I edit the manpage for the Windows netsh command.
Since the beginning of wireless networking I've never been able to remember the syntax for the netsh command, and worse, it's always needed when I am off the network so I can't even look it up on my laptop when I need it.
The command to get the name of the Ethernet NIC is easy enough to remember. ipconfig | findstr "Ethernet adaptor"
But then it gets a bit more complicated when you ask for more information. netsh interface ipv4 show config "eth0"
But it's really hard to remember the syntax to set the subnet & gateway. netsh interface ipv4 set address name="eth0" static 192.168.0.2 255.255.255.0 192.168.0.1
Worse, "/?" help doesn't really help (try it & let me know if it does). So is there a way for me to ADD that example into the "netsh /?" results?
netsh, as with many tools, gives you only top-level help if you use "<prog> /?". You have to drill down to get to a directive or even sub-directive to add /? to get help on the [sub]-directive, like:
netsh /? netsh interface /? then netsh interface ipv4 /? then netsh interface ipv4 set /? then netsh interface ipv4 set address /?
You could start at the end if you know all the args you want to specify, but I usually have to drill down through the help levels.
There are no man pages in Windows like there is in Linux. Help is built into the program. There is the 'help' command, but that just lists some DOS-mode programs.
Because the lanmanserver service starts early and binds to 445 on all interfaces, you may need to install a virtual kernel NIC driver in order to get an interface with a "spare" IP address to listen on, it was available from MS last time I needed it on Win7, not sure about Win10.
The topic at the time was a workaround to allow Windows SMB servers to communicate with Android SMB client where there is a port mismatch.
A catch22 arose that the Windows SMB server required specific ports (I think 445 but the actual port isn't the problem - the fact that the port is below 1024 is the problem). Windows is incapable of using any other port.
Then you have non-rooted Android, which is incapable of allowing an app to use any port below 1024.
Andy's netsh notes were to make Windows SMB "think" port 445 was a port higher than 445, for example, 1445, although I never got it to work.
If it ever did work, it would be a great bonus for Windows and Android users because then the non-rooted Android SMB client could work on port
1445 while the Windows SMB server would think port 1445 is port 445.
Did you ever get the syntax down perfectly? I never got it to work.
I don't know about the op but I, for one, _love_ this workaround!
Thank you for this elegant idea which will last me for years and many computers because it's so elegant and easy to maintain.
I called your code manpage.bat because I've learned the names have to be easily remembered, and coming from Linux, that's the first thing that comes to mind as the proper name for it.
You want all the added commands to be easily remembered even if you don't use them in a year or two or five or ten.
In a command window at the location of the batch file, I typed: manpage Which said: help is available for: netsh dir copy move type mkdir I typed: manpage netsh It reported: netsh interface ipv4 set address name="eth0" static 192.168.0.2 255.255.255.0 192.168.0.1 I typed: manpage dir It reported: anything you want to know about dir I typed: manpage foo It reported: help is available for: netsh dir copy move type mkdir
I don't like sticking things into my $PATH so I added it to the AppPaths. HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\manpage.exe @default=c:\path\manpage.bat So that "Win+R" & then "manpage" would get the results over the years.
formatting link
But it only flashed when I did that, even when I linked to a shortcut: @default=c:\path\manpage.lnk
Googling said to add "explorer.exe" to the beginning of that shortcut target to keep the command window but that also just flashed at me. manpage.lnk target=explorer.exe /k c:\path\manpage.bat
Then I prepended "%comspec% /k" to the shortcut target & that worked. target=%comspec% /k c:\path\manpage.bat
That worked wonderfully to open up a command window with the initial list of available commands already waiting for me (as it runs it first).
The command windows is already at the right path so there's no need to pollute the $PATH with yet another needless entry (enough already).
That's the whole purpose of the Windows AppPaths registry sub key.
formatting link
This is probably what I'll use for the next decade or two because it's simple and obvious and elegant enough to be easily remembered and when needed, it's eminently extensible as it's self explanatory.
Not sure if it works now, but in the 90s I edited (with a text editor!) command.com on a friend's computer for a laugh, so the error messages were amusing. I just found the strings of text and changed them, making sure the number of characters was the same.
And of course there's a way to edit an executable, it's a decompiler.
Cabling-Design.com Forums website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.