Batch file to Check if .exe file has a command line switch

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
bentom123
Posts: 3
Joined: 30 Jul 2012 08:36

Batch file to Check if .exe file has a command line switch

#1 Post by bentom123 » 30 Jul 2012 08:42

Hi guys,

I have been searching through on the internet for code that will check to see if an exe file contains any command line switches.

Unfortunately, I have been unable to find any.

MY Q: Does anybody know of, or write a piece of code that will check to see if an exe file contains any command line switches, and if it does, what they are?!

Thanks,

bentom123

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: Batch file to Check if .exe file has a command line swit

#2 Post by abc0502 » 30 Jul 2012 08:47

That will be tricky cause every program has it's own switches even the help switch -help or --help or -h

bentom123
Posts: 3
Joined: 30 Jul 2012 08:36

Re: Batch file to Check if .exe file has a command line swit

#3 Post by bentom123 » 30 Jul 2012 09:28

Hi,

Thanks for your quick reply

There must be a way...

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Batch file to Check if .exe file has a command line swit

#4 Post by Squashman » 30 Jul 2012 09:38

bentom123 wrote:Hi,

Thanks for your quick reply

There must be a way...

Can a computer figure out what I am thinking. There must be a way!
:roll:
Did you try Google Searching. I got a couple of hits. Don't know if they work.
http://www.technospot.net/blogs/find-co ... g-cmdline/
http://www.softpedia.com/get/System/Lau ... nder.shtml

But I would at least try typing the obvious after the name of the program as stated above.
/?
-help
--help
/help

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Batch file to Check if .exe file has a command line swit

#5 Post by foxidrive » 30 Jul 2012 09:44

Squashman wrote:But I would at least try typing the obvious after the name of the program as stated above.
/?
-help
--help
/help


plus some others to try:
-h
-?
?
help

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Batch file to Check if .exe file has a command line swit

#6 Post by foxidrive » 30 Jul 2012 09:45

What is the program? Googling can help too.

bentom123
Posts: 3
Joined: 30 Jul 2012 08:36

Re: Batch file to Check if .exe file has a command line swit

#7 Post by bentom123 » 30 Jul 2012 10:04

Hi,

thanks for all your replies :)

The batch file will use different exe files, so it is crucial that it manage's to find the switches...

Thanks for your reply :)

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Batch file to Check if .exe file has a command line swit

#8 Post by Squashman » 30 Jul 2012 10:10

Not gonna happen!

aGerman
Expert
Posts: 4748
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Batch file to Check if .exe file has a command line swit

#9 Post by aGerman » 30 Jul 2012 10:24

It depends on the developer of a software whether or not he enabled command line options, what names they have and what meaning/functionality is associated. Generally a batch file cannot determine that. It's good practice that those programs have a switch to display a help message, but
1) you can't rely on it
2) what switch is used to display that message will differ
3) a lot of programs will display it in a separate window (message box) and not in the cmd window which makes it difficult to determine with a batch code

I strongly recommend you to read the documentation for each of these programs instead.

Regards
aGerman

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Batch file to Check if .exe file has a command line swit

#10 Post by Squashman » 01 Aug 2012 12:21

While helping in another thread on the forum about command line switches for Windows Update I found another program by Microsoft that may help.
http://technet.microsoft.com/en-us/sysi ... 97439.aspx

Found this thread that uses it with the Windows update client.
http://www.msfn.org/board/topic/143031- ... there-any/

But automating it like you are trying to do may be impossible.

Edit:
another one is BinText but it is a gui.

Post Reply