capturing CMD batch file parameter list; write to file for later processing

Posted by BobB on Stack Overflow See other posts from Stack Overflow or by BobB
Published on 2010-05-02T01:38:46Z Indexed on 2010/05/02 1:47 UTC
Read the original article Hit count: 253

Filed under:
|
|

I have written a batch file that is launched as a post processing utility by a program. The batch file reads ~24 parameters supplied by the calling program, stores them into variables, and then writes them to various text files.

Since the max input variable in CMD is %9, it's necessary to use the 'shift' command to repeatedly read and store these individually to named variables. Because the program outputs several similar batch files, the result is opening several CMD windows sequentially, assigning variables and writing data files. This ties up the calling program for too long.

It occurs to me that I could free up the calling program much faster if maybe there's a way to write a very simple batch file that can write all the command parameters to a text file, where I can process them later. Basically, just grab the parameter list, write it and done.

Q: Is there some way to treat an entire series of parameter data as one big text string and write it to one big variable... and then echo the whole big thing to one text file? Then later read the string into %n variables when there's no program waiting to resume?

Parameter list is something like 25 - 30 words, less than 200 characters.

Sample parameter list:
"First Name" "Lastname" "123 Steet Name Way" "Cityname" ST 12345 1004968 06/01/2010 "Firstname+Lastname" 101738 "On Account" 20.67 xy-1z 1 8.95 3.00 1.39 0 0 239 8.95

Items in quotes are processed as string variables. List is space delimited.

Any suggestions?

© Stack Overflow or respective owner

Related posts about cmd

Related posts about parameters