1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

setting days back at prompt

Discussion in 'Support' started by dcohn, Sep 8, 2009.

  1. dcohn

    Joined:
    Jun 18, 2008
    Messages:
    8
    Likes Received:
    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?
     
  2. dcohn

    Joined:
    Jun 18, 2008
    Messages:
    8
    Likes Received:
    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
     
  3. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    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
     
  4. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,941
    Likes Received:
    30
    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
     
  5. dcohn

    Joined:
    Jun 18, 2008
    Messages:
    8
    Likes Received:
    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
     
  6. Howard Goldstein

    Joined:
    Jun 1, 2008
    Messages:
    111
    Likes Received:
    1
    Dcohn wrote:


    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



     
  7. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,855
    Likes Received:
    83
    If you have a trailing & on a command line, TCC interprets it as a detach request (like the Linux shells do).
     
  8. jimrawlings

    Joined:
    Jun 1, 2008
    Messages:
    2
    Likes Received:
    0
    -------------------------- Try SET DaysBack=%1 instead of SET DaysBack="%1"...
     
  9. jimrawlings

    Joined:
    Jun 1, 2008
    Messages:
    2
    Likes Received:
    0
    --------------------------

    Try SET DaysBack=%1 instead of SET DaysBack="%1"...
     
  10. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    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
     
  11. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    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
     
  12. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,855
    Likes Received:
    83
    Steve Fábián wrote:

    "What's New", and "DETACH".

    Rex Conn
    JP Software
     
  13. dcantor

    Joined:
    May 29, 2008
    Messages:
    507
    Likes Received:
    3
    May I suggest an index entry for the ampersand symbol & to lead to DETACH?
     

Share This Page