×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

GRiP ~ Xspawn

GRiP ~ Xspawn

GRiP ~ Xspawn

(OP)
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

RE: GRiP ~ Xspawn

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

RE: GRiP ~ Xspawn

(OP)
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.

RE: GRiP ~ Xspawn

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

RE: GRiP ~ Xspawn

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

RE: GRiP ~ Xspawn

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources