Computing.Net > Forums > Programming > batch commandline arg with =

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

batch commandline arg with =

Reply to Message Icon

Name: timothy_aah
Date: July 30, 2008 at 12:32:45 Pacific
OS: xp/vista
CPU/Ram: AMD x2 4200+/2GB
Comment:

Hi,

I would like to pass a commandline argument to another batch/exe, it looks like this:

start filename.exe mod=something

"mod=something" is ONE SINGLE command line arg, that canNOT be changed in the app it's being sent to
if I send it to another batch file to test the output I get now,
then %1 is set to "mod"
and %2 is set to "something"
but I need %1 to be "mod=something"
how would I do this?



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: July 30, 2008 at 13:22:33 Pacific
Reply:

In the batch that accepts your parameter code %* to get the full command tail, i.e.

First batch

call second.bat mod=something

Second batch

start filename.exe %*

obviously in that way you can pass just one parameter on the command line.


0

Response Number 2
Name: tonysathre
Date: July 30, 2008 at 13:34:53 Pacific
Reply:

@echo off
set mod=mod=something
start filename.exe %mod%


0

Response Number 3
Name: timothy_aah
Date: July 30, 2008 at 13:45:37 Pacific
Reply:

thx, hadn't tried that yet
it's still not 100% though, you need to put it between quotes for it to work,
otherwise the "=" character and everything that follows it is not stored in the variable
so this is what I did, and now it works:

@echo off
set mod="mod=something"
start filename.exe %mod%


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: batch commandline arg with =

Batch File Creation with MD www.computing.net/answers/programming/batch-file-creation-with-md/11547.html

batch:open file with windowsize&pos www.computing.net/answers/programming/batchopen-file-with-windowsizeamppos/15159.html

BATCH - set varible with findstr www.computing.net/answers/programming/batch-set-varible-with-findstr-/14944.html