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

ccb

Jul 13, 2009
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

  • accFind.bat
    3.6 KB · Views: 112

ccb

Jul 13, 2009
47
0
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?
 

ccb

Jul 13, 2009
47
0
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.)
 
Jun 7, 2008
101
5
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>
 
Similar threads
Thread starter Title Forum Replies Date
S How to? Deinstalling TC/reinstating execution of bat files by cmd in Win7 Support 31
CWBillow TCC and CMD / BAT files Support 3
jdanielp Cannot step into and/or call another .bat file when debugging .bat file Support 2
M Oracle batch OPatch.bat.bat not working in TCC but correctly in CMD Support 5
M Problem with VSDevCmd.bat in VS 16.7.3 Support 0
Joe Caverly .BAT works in TCC-RT 25, but not in TCC-RT 26 Support 4
I BTM slower than BAT? Support 14
S incorrect message at start Cancel batch job 4START.bat ? (Y/N/A) : Support 1
S Debugger Bat file call history Support 9
E How to? use Executable Extensions: .bat and .cmd Support 8
P MS VS2013 vsdevcmd.bat fails to run with tcmd 17 x64 Support 10
I How to? Bat Works but BTM Doesn't Support 6
C Documentation .CMD .BAT .BTM Support 15
w_krieger WAD 4DOS and benny.bat Support 2
A Stupid, obvious question - launch a BAT with TC Support 10
Mordachai How to get a TC interface instead of a console for .btm, .bat, ? Support 10
A WAD BOM printed on command line from BAT file Support 5
C Simple .bat question - dump contents of 2 dimensional array Support 2
C .CMD .vs. .BAT Support 3
B Strange handling of a .BAT file Support 5
Roedy bat file properties Support 1
MickeyF TCC crashing when copying multiple files (now resolved) Support 6
fpefpe How to? shortcuts and batch files Support 4
C v28 key files Support 2
J ffind does not find files Support 4
C duplicate files in multiple plugin sites Support 9
Dmitry L. Kobyakov Fixed The SETARRAY /R command works incorrectly with cyrillic files Support 2
vefatica FFIND, temp files? ... not deleted? Support 0
R FUNCTION to count NUMBER of files matching a pattern and specific length/not length Support 4
vefatica Tmp files from in-process pipes not deleted Support 6
vefatica Finding files with alternate data streams? Support 4
rps Multi-column DIR /v not displaying all files. Support 5
D How to skip files in a fileset? Support 6
vefatica PIPEVIEW leaves TMP files Support 18
K "copy /z /w" command not deleting read-only files in destination Support 10
Jesse Heines "Taken" date for JPG and PNG files Support 4
O I cannot use links to .btm files Support 5
C How to? rename files with spaces Support 8
R How to? Append files in multiple subfolders using copy? Support 8
Joe Caverly "Functions" in cmd.exe batch files Support 6
S Batch files Calling Batch Files Support 2
vefatica Find Files/Text dialog: does it work? Support 0
Joe Caverly UNZIPping older .ZIP files Support 3
C Documentation default location for LOG files Support 21
P exit /b in batch files Support 7
P Labels in batch files: TCC vs CMD.exe Support 9
M ANSI is used to show files instead of OEM in version 17 to 19 ! Support 5
C 7Z files on forum? Support 0
x13 Problem listing repository files using DIR http(s)://... Support 8
B Can copy command concatenate multiple mp3 files Support 2

Similar threads