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
4
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
11,546
104
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
12,406
152
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
4
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
4
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
 
Similar threads
Thread starter Title Forum Replies Date
vefatica Setting the default value with @REGSET? Support 1
vefatica Setting array variable ignores leading spaces (and @execarray doesn't) Support 4
vefatica VIEW ... remember the UTF-8 setting? Support 0
S Setting Tabs=Bottom makes text turn black Support 6
rps TCMD Tabs priority option setting Support 0
R ffind not setting %_ffind_ vars if /f is used Support 7
C How to? Setting up SMTP access for Yahoo with TCMD v20 Support 7
Alpengreis WAD Each start/close of TCMD changes my Explorer setting Support 7
J Variable setting regression in tcc17 ? Support 5
williamleara WAD ribbon doesn't remember expand/collapse setting Support 3
CWBillow Setting and changing Vars in batch files Support 26
Jay Sage SENDMAIL Apparently Not Setting Priority Support 2
G Display setting for Tabbed Toolbar Support 1
C How to? date1 - date2 = number of days Support 10
Stefano Piccardi did the forum software change in the last two days? Support 2
rconn Out of action for a few days Support 4
vefatica ANSI, PROMPT ... ??? Support 1
FreezerBurnt ANSI Prompt messes up list output. Support 39
FreezerBurnt "Missing SETLOCAL" when initializing Visual Studio Command Prompt. Support 9
M How to? Black TCC Prompt Support 2
N Command execution slows down in TCC Prompt after a while Support 6
K Fixed Prompt display will be shifted after use dir to display a filename with Chinese. (v25.00.28 x64) Support 18
vefatica Timing commands with $= in the prompt? Support 16
samintz How to? Alias or prompt? Support 1
T Elapsed time format in prompt changed in TCC 25 Support 10
samintz MOVE and Prompt on overwrite Support 3
robinsiebler Creating a custom prompt Support 9
K TCC prompt background color Support 4
Alpengreis Problem if command prompt is not legacy Support 4
Joe Caverly Documentation Customizing the TCC Prompt Support 0
C How to? handle the UAC prompt on computer restarts with Everything Support 3
B when doing SFTP via IFTP to my secure site my users always get the finger print key prompt Support 1
M PROMPT with git branch Support 1
MikeBaas How to? SELECT: exclude files / display prompt Support 2
vefatica ? "prompt" command Support 3
S Elapsed time in TCC prompt question Support 0
Joe Caverly Determine if program started from command prompt Support 2
W Opening a new tab takes forever to get the command prompt Support 5
vefatica UAC prompt? Support 0
C How to? ctrl-c does not prompt "Terminate batch job" Support 2
Mordachai TCMD Prompt Here?!@ Support 14
vefatica Fixed DO, OSD, and cancel batch prompt Support 3
CWBillow Send Command-line with prompt? Support 6
David McClelland Why the prompt to del c:\* Support 7
S WAD BDEBUGGER command changes window title to "TCC Prompt" Support 4
S WAD Invoking BDEBUGGER changes window title to "TCC Prompt" Support 7
vefatica Cancel batch prompt? Support 0
1 CMD file kicks out to prompt Support 18
Steve Pitts Are you sure prompt from DEL command Support 5
Exolon Strange Prompt. Support 6

Similar threads