setting days back at prompt

Jun 18, 2008
8
0
I tested this and I see that at the command prompt everything works perfectly but I created a shortcut and it is not applying my parameter on the command line

C:\dir1\batchfile.btm 3

The 3 does not get passed to my btm properly from the shortcut.

The info below was more than I needed to post I see now



I have a script that I run using Date functions that many here helped me with.

Basically batchfile.btm 2 should run the command 2 days back.

When I manually run the command it works perfectly so I have determined the error is here


REM allow for more days back for copy
iff "%1"=="" THEN &
SET DaysBack=1
else
SET DaysBack="%1"
endiff


The default sets my days back to 1 in this line

SET PhotoDate=%@MAKEDATE[%@EVAL[%@DATE[%_DATE] - %DaysBack]]

The issue is that when I create a shortcut to the batch file to set it back 2 days (I run batchfile.btm 2) It does not use the 2 at all.

Can you see from this what I have done wrong possibly?
 
Jun 18, 2008
8
0
I added c:\utils\4nt\4nt.exe to the beginning of the shortcut and now it works well

Should I do anything else or is that acceptable?

So the shortcut is

c:\utils\4nt\4nt.exe C:\dir1\batchfile.btm 3
 
May 20, 2008
3,515
3
Elkridge, MD, USA
dcohn wrote:
| I have a script that I run using Date functions that many here
| helped me with.
|
| Basically batchfile.btm 2 should run the command 2 days back.
|
| When I manually run the command it works perfectly so I have
| determined the error is here
|
|
| REM allow for more days back for copy
| iff "%1"=="" THEN &
| SET DaysBack=1
| else
| SET DaysBack="%1"
| endiff
|
|
| The default sets my days back to 1 in this line
|
| SET PhotoDate=%@MAKEDATE[%@EVAL[%@DATE[%_DATE] - %DaysBack]]
|
| The issue is that when I create a shortcut to the batch file to set
| it back 2 days (I run batchfile.btm 2) It does not use the 2 at
| all.
|
| Can you see from this what I have done wrong possibly?

Yes. You use "2" instead of 2 via the line
SET DaysBack="%1"

Try this logic instead:

set DaysBack=%@if[%# gt 0,%1,1]

--
HTH, Steve
 
May 20, 2008
9,630
64
Syracuse, NY, USA
On Tue, 08 Sep 2009 15:52:45 -0500, dcohn <> wrote:

|REM allow for more days back for copy
|iff "%1"=="" THEN &
| SET DaysBack=1
|else
| SET DaysBack="%1"
|endiff

Get rid of the "&".

Interesting result: the code above (as is) produces (for example):

v:\> dback.bat 3
The process ID is 2060
TCC: V:\dback.bat [4] Unknown command "else"
TCC: V:\dback.bat [6] Unknown command "endiff"

Where's the PID message coming from?
--
- Vince
 
Jun 18, 2008
8
0
Sorry guys

Thank you!!!

VERSION 5 I am running on this machine.

It is an old client that never updated again. Thinking that TCC Free would do the job as well as they do not use sendmail anyway
 
Dcohn wrote:


>I have a script that I run using Date functions that many here helped me
>with.
>
> Basically batchfile.btm 2 should run the command 2 days back.
>
> When I manually run the command it works perfectly so I have determined
> the error is here
>
>
> REM allow for more days back for copy
> iff "%1"=="" THEN &
> SET DaysBack=1
> else
> SET DaysBack="%1"
> endiff
>
>
> The default sets my days back to 1 in this line
>
> SET PhotoDate=%@MAKEDATE[%@EVAL[%@DATE[%_DATE] - %DaysBack]]
>
> The issue is that when I create a shortcut to the batch file to set it
> back 2 days (I run batchfile.btm 2) It does not use the 2 at all.
>
> Can you see from this what I have done wrong possibly?
>
1. What version of TCMD (or 4NT)?

2. There are several errors in your syntax - missing spaces, extra quotes
and an incorrect ampersand. I think it should look more like this:

iff "%1" == "" THEN
SET DaysBack=1
else
SET DaysBack=%1
endiff

3. If that doesn't help, please show us how you've defined your shortcut.

--
Howard
----- Original Message -----
From: "dcohn" <>
To: <hgoldst1@sbcglobal.net>
Sent: Tuesday, September 08, 2009 4:52 PM
Subject: [Support-t-1373] setting days back at prompt



>I have a script that I run using Date functions that many here helped me
>with.
>
> Basically batchfile.btm 2 should run the command 2 days back.
>
> When I manually run the command it works perfectly so I have determined
> the error is here
>
>
> REM allow for more days back for copy
> iff "%1"=="" THEN &
> SET DaysBack=1
> else
> SET DaysBack="%1"
> endiff
>
>
> The default sets my days back to 1 in this line
>
> SET PhotoDate=%@MAKEDATE[%@EVAL[%@DATE[%_DATE] - %DaysBack]]
>
> The issue is that when I create a shortcut to the batch file to set it
> back 2 days (I run batchfile.btm 2) It does not use the 2 at all.
>
> Can you see from this what I have done wrong possibly?
>
>
>
>
 

rconn

Administrator
Staff member
May 14, 2008
11,237
103
On Tue, 08 Sep 2009 15:52:45 -0500, dcohn <> wrote:

|REM allow for more days back for copy
|iff "%1"=="" THEN &
| SET DaysBack=1
|else
| SET DaysBack="%1"
|endiff

Get rid of the "&".

Interesting result: the code above (as is) produces (for example):

v:\> dback.bat 3
The process ID is 2060
TCC: V:\dback.bat [4] Unknown command "else"
TCC: V:\dback.bat [6] Unknown command "endiff"

Where's the PID message coming from?
If you have a trailing & on a command line, TCC interprets it as a detach request (like the Linux shells do).
 
Jun 1, 2008
2
0
I tested this and I see that at the command prompt everything works perfectly but I created a shortcut and it is not applying my parameter on the command line

C:\dir1\batchfile.btm 3

The 3 does not get passed to my btm properly from the shortcut.

The info below was more than I needed to post I see now



I have a script that I run using Date functions that many here helped me with.

Basically batchfile.btm 2 should run the command 2 days back.

When I manually run the command it works perfectly so I have determined the error is here


REM allow for more days back for copy
iff "%1"=="" THEN &
SET DaysBack=1
else
SET DaysBack="%1"
endiff


The default sets my days back to 1 in this line

SET PhotoDate=%@MAKEDATE[%@EVAL[%@DATE[%_DATE] - %DaysBack]]

The issue is that when I create a shortcut to the batch file to set it back 2 days (I run batchfile.btm 2) It does not use the 2 at all.

Can you see from this what I have done wrong possibly?
-------------------------- Try SET DaysBack=%1 instead of SET DaysBack="%1"...
 
Jun 1, 2008
2
0
I tested this and I see that at the command prompt everything works perfectly but I created a shortcut and it is not applying my parameter on the command line

C:\dir1\batchfile.btm 3

The 3 does not get passed to my btm properly from the shortcut.

The info below was more than I needed to post I see now



I have a script that I run using Date functions that many here helped me with.

Basically batchfile.btm 2 should run the command 2 days back.

When I manually run the command it works perfectly so I have determined the error is here


REM allow for more days back for copy
iff "%1"=="" THEN &
SET DaysBack=1
else
SET DaysBack="%1"
endiff


The default sets my days back to 1 in this line

SET PhotoDate=%@MAKEDATE[%@EVAL[%@DATE[%_DATE] - %DaysBack]]

The issue is that when I create a shortcut to the batch file to set it back 2 days (I run batchfile.btm 2) It does not use the 2 at all.

Can you see from this what I have done wrong possibly?
--------------------------

Try SET DaysBack=%1 instead of SET DaysBack="%1"...
 
May 20, 2008
3,515
3
Elkridge, MD, USA
E. S. Fabian wrote on 2009.09.08 @ 17.37 EDT, but it was never posted:
| dcohn wrote:
|| I have a script that I run using Date functions that many here
|| helped me with.
||
|| Basically batchfile.btm 2 should run the command 2 days back.
||
|| When I manually run the command it works perfectly so I have
|| determined the error is here
||
||
|| REM allow for more days back for copy
|| iff "%1"=="" THEN &
|| SET DaysBack=1
|| else
|| SET DaysBack="%1"
|| endiff
||
||
|| The default sets my days back to 1 in this line
||
|| SET PhotoDate=%@MAKEDATE[%@EVAL[%@DATE[%_DATE] - %DaysBack]]
||
|| The issue is that when I create a shortcut to the batch file to set
|| it back 2 days (I run batchfile.btm 2) It does not use the 2 at
|| all.
||
|| Can you see from this what I have done wrong possibly?
|
| Yes. You use "2" instead of 2 via the line
| SET DaysBack="%1"
|
| Try this logic instead:
|
| set DaysBack=%@if[%# gt 0,%1,1]

IIRC the responses never showed the above construct or anything similar, so
it is still germane.
--
Steve
 
May 20, 2008
3,515
3
Elkridge, MD, USA
rconn wrote:
| If you have a trailing & on a command line, TCC interprets it as a
| detach request (like the Linux shells do).

Can you refresh my memory where this is documented?
--
Steve