Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

.bat files works in cmd.exe, not in TCMD

  • Thread starter Thread starter ccb
  • Start date Start date
Jul
47
0
>ver

TCC 12.11.69 x64 Windows 7 [Version 6.1.7601]

Hello,
I have a batch file (created by someone else) that runs correctly in Win7's cmd.exe.
It does not run correctly in TCC.
What's the best way to diagnose the problem?
I am trying to break down the loops to isolate the problem, but I haven't worked much with batch files recently... Are there some known compatibility issues between TCC and cmd.exe?
Thanks for any advice...
 

Attachments

What does it do incorrectly? Did you try changing the first line to "echo on" and running it?

The batch file calls an SCM executable to get some information, then tries to find a specific filename in the SCM's output.

When run under cmd.exe, it produces the correct results; when run under TCMD, it does not.
Turning echo on just reiterates the command line, but provides little insight into what is going wrong.
I'll add more output to try to figure out what is not working correctly.
 
In IF statements, there should be a space before and after ==.

If you posted the output from accurev and the expected and actual output from the bat file, it would be easier to figure out the problem.

Do you have a reason for wanting to run the bat file under TCC instead of using cmd?
 
In IF statements, there should be a space before and after ==.
If you posted the output from accurev and the expected and actual output from the bat file, it would be easier to figure out the problem.
Do you have a reason for wanting to run the bat file under TCC instead of using cmd?
Thanks for the replies.
I want to run the .bat file in TCC because I hoped (expected?) TCC was compatible, and I wouldn't have to run TCC and cmd.exe at the same time...

Here's the output from the accurev command (output is xml, and the formatting was lost when I copied and pasted into this post):
[C:\bin]
>accurev show -fx -p JPSoft streams
<?xml version="1.0" encoding="utf-8"?>
<streams>
<stream
name="JPSoft"
depotName="JPSoft"
streamNumber="1"
isDynamic="true"
type="normal"
startTime="1131726198"/>
<stream
name="JPSoft_work"
basis="JPSoft"
basisStreamNumber="1"
depotName="JPSoft"
streamNumber="2"
isDynamic="true"
type="normal"
startTime="1131726232"/>
<stream
name="JPSoft_work_ragnarokII"
basis="JPSoft_work"
basisStreamNumber="2"
depotName="JPSoft"
streamNumber="17"
isDynamic="false"
type="workspace"
startTime="1294923718"/>
<stream
name="JP-FallLine_fallline"
basis="JPSoft_work"
basisStreamNumber="2"
depotName="JPSoft"
streamNumber="18"
isDynamic="false"
type="workspace"
startTime="1296164739"/>
</streams>

It appears the first problem occurs with this line:
Code:
FOR /F "tokens=1,2 delims==" %G IN ('accurev show -fx -p JPSoft streams') DO (@echo %G)

The output from cmd.exe, (runs in ~1 sec):
[C:\bin]
>FOR /F "tokens=1,2 delims==" %G IN ('accurev show -fx -p JPSoft streams') DO (@echo %G)

[C:\bin]
>()
<?xml version

[C:\bin]
>()
<streams>

[C:\bin]
>()
<stream

[C:\bin]
>()
name

[C:\bin]
>()
depotName

[C:\bin]
>()
streamNumber

[C:\bin]
>()
isDynamic

[C:\bin]
>()
type

[C:\bin]
>()
startTime
(Only quoted output from 1st stream)

And the output from TCC:
C:\bin]
>timer & FOR /F "tokens=1,2 delims==" %G IN ('accurev show -fx -p JPSoft streams') DO (@echo %
G) & timer
Timer 1 on: 14:31:57
TCC: (Sys) The filename, directory name, or volume label syntax is incorrect.
"C:\bin\?xml"
TCC: (Sys) The system cannot find the file specified.
""
TCC: (Sys) The system cannot find the file specified.
"C:\bin\stream"
name
depotName
streamNumber
isDynamic
type
startTime

TCC: (Sys) The system cannot find the file specified.
""
Timer 1 off: 14:32:24 Elapsed: 0:00:26.42
(Again, I snipped all but the output from the 1st stream.)
 
On Sun, Jul 24, 2011 at 2:48 PM, ccb <> wrote:

> I want to run the .bat file in TCC because I hoped (expected?) TCC was compatible, and I wouldn't have to run TCC and cmd.exe at the same time...

For a case like that, I wouldn't bang my head against the wall. I
might prefer tcc as my command interpreter, but it's no big deal to do
"cmd /c <batchfile>" if for some reason it doesn't work in tcc.
There's a limit to how much time and effort I'd want to invest in
figuring out *why* it didn't work, especially if I had work to do
involving the desired results.
______
Dennis
 
I want to run the .bat file in TCC because I hoped (expected?) TCC was compatible, and I wouldn't have to run TCC and cmd.exe at the same time...

But, why does it have to work in both TCC and cmd? You can create an alias in TCC that uses cmd to run the bat file. If it only has to work in TCC, then DO is preferable to FOR.

TCC is about as compatible as it can be considering all the additional features it has.

Here's the output from the accurev command (output is xml, and the formatting was lost when I copied and pasted into this post):

You have to click the "<>" button on the formatting toolbar on the webpage to get it to preserve your html.

I'm a bit surprised that one can use a command in single quotes with FOR /F. I think the Help says it wants a list of filenames unless you use the usebackq option, in which case you would use back quotes.

However, it seems to be working when I try it:

Code:
C:\Junk>type foo.txt
name="JPSoft"
depotName="JPSoft"
streamNumber="1"
isDynamic="true"
type="normal"
startTime="1131726198"
name="JPSoft_work"
basis="JPSoft"
basisStreamNumber="1"
depotName="JPSoft"
streamNumber="2"
isDynamic="true"
type="normal"
startTime="1131726232"
name="JPSoft_work_ragnarokII"
basis="JPSoft_work"
basisStreamNumber="2"
depotName="JPSoft"
streamNumber="17"
isDynamic="false"
type="workspace"
startTime="1294923718"
name="JP-FallLine_fallline"
basis="JPSoft_work"
basisStreamNumber="2"
depotName="JPSoft"
streamNumber="18"
isDynamic="false"
type="workspace"
startTime="1296164739"

C:\Junk>type foo.btm
FOR /F "tokens=1,2 delims==" %G IN ('type foo.txt') DO (echo %G)

C:\Junk>foo.btm
name
depotName
streamNumber
isDynamic
type
startTime
name
basis
basisStreamNumber
depotName
streamNumber
isDynamic
type
startTime
name
basis
basisStreamNumber
depotName
streamNumber
isDynamic
type
startTime
name
basis
basisStreamNumber
depotName
streamNumber
isDynamic
type
startTime

C:\Junk>
 
Back
Top
[FOX] Ultimate Translator
Translate