Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

GRiP ~ Xspawn

Status
Not open for further replies.

Befuddled

Aerospace
Jan 9, 2008
75
I am creating a simple GRip Programme to generate a string.

I then need this string send to a batch file as an argument which the batch file can then use.

I can get the xpsawn command to execute the batch file, but cant get it to accept the argument.

I'm not sure if it’s the GRiP programme which is wrong, or my batch file.

Does any one have an example?

Cheers,

Befuddled
 
Replies continue below

Recommended for you

I'm not sure that you can't pass an argument to a batch file but I wouldn't know what works. Perhaps we tried it also without luck. My thoughts would be that grip can do just about any string manipulation that you could want, so why no output a file from grip with the arguments in there and then just XSPAWN your batch file which calls the output file as part of its procedure.

Best of Luck

Hudson
 
I'm using the batch file to launch a 3 party application which accepts arguments.

PS. I have manually checked the batch file and it works ok. So its something i am doing with the xspawn command.
 
Build your string or strings with the arguments and write that to your batch file. Then use XSPAWN to run your batch file.


"Wildfires are dangerous, hard to control, and economically catastrophic."

Ben Loosli
 
Yes, what Ben said.

I wouldn't think XSPAWN is going to pass the arguments to you 3rd party application correctly. If you're trying to write a command line argument with a series of switches you couldn't be sure that Grip will output the XSPAWN without interpreting those switches for itself. This may be unfortunate, but as always try a simple example first to prove the case and take it from there.

What we are suggesting seems the easier work around having limited expectations of GRIP. You're almost certain to be able to get something to work. You can even get one batch file to run another if you need to rename the grip output file from .txt to .bat

I'd start by creating a grip program that uses XSPAWN to run a simple batch job that just says "hello" or something, then once you know that you can get XSPAWN to work at all then you have something useful to build on.

Best Regards

Hudson
 
Befuddled,

In this example the two arguments have been hardcoded as arg1 and arg2 but I believe that deriving the string(s) for the argument(s) is not the issue in the original question.

Grip source code:

xspawn/'cmd.exe','/c','start','"title"','z:\batch_test.bat','arg1','arg2'
halt

Batch file source code:

@echo off
echo %0
echo %*

The output is displayed in a dos shell:

z:\batch_test.bat
arg1 arg2


This xspawn example is overly complex in order to force the display to output in a visible dos shell window. The command could be shortened to just

xspawn/'cmd.exe','/c','z:\batch_test.bat','arg1','arg2'

In the example batch file the %* means "all arguments" as opposed to the specific arguments %1 and %2.

Regards, Joe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor