Reputation: 21
Okay so basically I have created a suite of tools to use with the command line (cmd), and I want to add switches to them the same way you would for a command like ipconfig
. You have IpConfig
and IpConfig /all
. My command will be called nettools
. Currently it is a batch file inside of the C:\windows\system32 folder that uses the type
command to display a text files contents. In this file are the names of the tools and their descriptions. This command does not pause or ask for user input it only displays the info inside of the txt file. How can I add switches such as nettools /?
or nettools /snif
....
Please watch the following video as the answers provided have also failed to work.
Upvotes: 0
Views: 570
Reputation: 57252
@echo off
SET "parameter=%~1"
if /i "%parameter%" equ "" goto :help
for %%p in (putty tcpview fiddler ) do (
if /i "%parameter:~1%" equ "%%~p" goto :%%~p
rem if /i "%parameter%" equ "%%~p" goto :%%~p
)
goto :wrong_parameter
:putty
start putty (or call putty.bat)
goto :eof
:tcpview
start wget (or call the bat)
goto :eof
and so on. (will not work with "?wget" ) you can use directly START to call the tools if they are in the %PATH% or in the same directory.
Upvotes: 1