0

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.

http://youtu.be/UrYeUq2PpsQ

  • Where are you getting stuck? Show some code... – foxidrive Sep 09 '13 at 04:57
  • 1
    Take a look at [Windows Bat file optional argument parsing](http://stackoverflow.com/q/3973824/1012053), especially the answer that was *not* accepted. – dbenham Sep 09 '13 at 10:05
  • Sorry. "Please go watch this video so you'll know what I'm asking" is not how SO works. All necessary information for your question needs to be here. If the off-site location is not available for some reason (off-line, moved, removed), your question is meaningless. Off-site video is also not searchable here by future users of this site. The [help] and [about] pages have more info about asking questions here. – Ken White Sep 12 '13 at 15:32
  • Firstly your quote was not mine so do not refer it to me. Secondly I did put all of the information yet people did not fully understand my meaning as pixels of letters can only do so much. And unless you would like to specifically point out somewhere that states that I am intolerably prohibited from requesting to watch my video asking the question, I suggest not spamming about how someone added a link. thank you.@KenWhite – cmdexpert12 Sep 13 '13 at 02:34

1 Answers1

1
@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.

npocmaka
  • 55,367
  • 18
  • 148
  • 187
  • Sorry to say but this did not work for me, please watch the video in the question. At first I thought it worked because I had typed in the putty command in a separate window and forgot about it. Please watch the video before answering. Thank You! – cmdexpert12 Sep 11 '13 at 21:12
  • so you you want to compare switches without their first symbol which could be `-` or `/` ? – npocmaka Sep 11 '13 at 22:23
  • Yes, I would prefer the `/` but `-` will suit me just as well. Thank you for taking the time to understand me.@npocmaka – cmdexpert12 Sep 13 '13 at 02:35