Topic Options
#409 - 04/27/02 06:41 AM -command with arguments with spaces
Charles Offline
Junior Member

Registered: 04/25/02
Posts: 7
Loc: Oklahoma, USA
I am working on a script the proceeds in the process:

-action -set filename="filename 04-26-02"
# or whatever today's date is
-command -wait c:\md\md5.exe "c:\directory\%filename%"

It would appear that it isn't passing the quotes, and so it is trying to create the md5 hash based on "filename", and replies "return code(2)". If I remove the space it works.

Your input is appreciated, Charles
_________________________
Charles McKinnis
cmckinnis@revantine.net

Cisco Certified Network Associate
CompTIA Network+
CompTIA A+

Top
#410 - 04/28/02 05:39 AM Re: -command with arguments with spaces
Luke Tomasello Administrator Offline
Member

Registered: 09/17/00
Posts: 740
Loc: San Jose, CA., USA
Good catch Charles.

WinCron was correctly handling spaces in the pathname of the program to launch but was failing to process any spaces that may be in the individual arguments.

Download WinCron 3.7.7

This version should do what you want.
_________________________
Regards,
Luke Tomasello

Top
#411 - 05/06/02 11:18 AM Re: -command with arguments with spaces
Charles Offline
Junior Member

Registered: 04/25/02
Posts: 7
Loc: Oklahoma, USA
This fixed my argument problem, but previously I used:
-command -wait fc "%filepath%%newmd5file%" "%filepath%%md5file%" >%filepath%%fcresult%

and it worked with no spaces in the fcresult. However, now it will not dump in to the file. I have tried:
>"file",
">file", and
>file

By comparing the files and emailing the result to myself, I can verify the file is complete.

If there a way to act on the return code? Incidently, I get return code(0) when I test these files, because they match. If they do not match then I get a different return code. If I could call another function based on return code then I could email myself a success or fail email.

Thanks, Charles
_________________________
Charles McKinnis
cmckinnis@revantine.net

Cisco Certified Network Associate
CompTIA Network+
CompTIA A+

Top
#412 - 05/07/02 05:41 AM Re: -command with arguments with spaces
Luke Tomasello Administrator Offline
Member

Registered: 09/17/00
Posts: 740
Loc: San Jose, CA., USA
Charles,

I'm looking into a solution for you.
It should be pretty easy to hookup exception handling for the return value from –command. If I did this, you could setup an exception handler to handle the case when the two files don't compare (you could then send the email or something.)

I'll post here when I've got the solution.
_________________________
Regards,
Luke Tomasello

Top
#413 - 05/09/02 02:07 AM Re: -command with arguments with spaces
Luke Tomasello Administrator Offline
Member

Registered: 09/17/00
Posts: 740
Loc: San Jose, CA., USA
Charles,

I'm still looking into supporting redirection on the command line via '>' but haven't yet decided on the best approach.

I did however make it possible for you to capture the result code from a spawned command, then test it and branch accordingly.

Please download this patched version of WinCron.dll to see if it fits your needs. If so I will roll out a new version incorporating this new functionality.

Here is the Patch WinCron.dll for your testing pleasure.

Let me know how this works for you.

## test_test
# This script shows how to use the arithmetic evaluator and exception handler built into WinCron.
# The script will compare two files and branch accordingly,
# we use the -test directive to do conditional branching.

{
-name test_test
-start
-action -onerror no_match
-command -wait fc c:\temp\f1.txt c:\temp\f2.txt
-action -test "%TG.COMMAND_RETURN% == 0"
-action -print The files did match!
-action -inc 0 0 0 5
}

{
-name no_match
-action -print The files did NOT match
-action -return break
}
_________________________
Regards,
Luke Tomasello

Top
#414 - 05/12/02 08:45 AM Re: -command with arguments with spaces
Charles Offline
Junior Member

Registered: 04/25/02
Posts: 7
Loc: Oklahoma, USA
I have worked with the function, this is nice \:\)

I think I may try to automate a retry if it fails. I have it send me 2 messages, one with the old sig and one with the new sig if it fails (can I attach both to one?).

Thanks, Charles
_________________________
Charles McKinnis
cmckinnis@revantine.net

Cisco Certified Network Associate
CompTIA Network+
CompTIA A+

Top
#415 - 05/20/02 10:14 AM Re: -command with arguments with spaces
Luke Tomasello Administrator Offline
Member

Registered: 09/17/00
Posts: 740
Loc: San Jose, CA., USA
Quote:
Originally posted by Charles:
can I attach both to one?


WinCron only lets you attach one file at a time, but I know some users are using ZIP utilities to combine multiple files into a single attachment.

PS. Redirection is working again in the latest release WinCron version 3.7.8 .
_________________________
Regards,
Luke Tomasello

Top


Moderator:  Luke Tomasello