Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MSDOS Batch File problem

71 views
Skip to first unread message

cedars...@googlemail.com

unread,
Mar 22, 2012, 3:52:16 PM3/22/12
to
Hi All,

Haven't used DOS for a long while but, now that I must, I have a
problem..

Trying to run a batch file that only contains the following commands.

echo off
cls
mode com1: 9600,n,8,1
(set com1)
barkb
(load barcode scanner drivers)
barkbset start
(start the barcode scanner)
accounts.exe
(start the accounting program)

Everything appears to work and the accounts program runs as normal
(from a Windows shortcut) except, the bar code scanner does not work.

If I run the batch file from the command prompt, I get the same result
but, if I run the commands one at a time from the command prompt, it
all works properly.

Any ideas which claim to 'stupidity' I can make today?

TNX
Colin

Auric__

unread,
Mar 22, 2012, 5:17:08 PM3/22/12
to
cedars...@googlemail.com wrote:

> Haven't used DOS for a long while but, now that I must, I have a
> problem..
>
> Trying to run a batch file that only contains the following commands.
>
> echo off
> cls
> mode com1: 9600,n,8,1
> (set com1)
> barkb
> (load barcode scanner drivers)

It may be that some sort of delay is needed. Try adding "pause" here...

> barkbset start
> (start the barcode scanner)

...and if that doesn't work, try here instead.

> accounts.exe
> (start the accounting program)
>
> Everything appears to work and the accounts program runs as normal
> (from a Windows shortcut) except, the bar code scanner does not work.
>
> If I run the batch file from the command prompt, I get the same result
> but, if I run the commands one at a time from the command prompt, it
> all works properly.
>
> Any ideas which claim to 'stupidity' I can make today?

--
...with breath like a rocket booster and teeth like a park fence...

cedars...@googlemail.com

unread,
Mar 22, 2012, 6:31:10 PM3/22/12
to

Already tried inserting a 'Pause' command before each line. No joy
there.

Is it possible that calling the batch file instigates a new 'Cmd'
instance?

Colin

Michael Bednarek

unread,
Mar 22, 2012, 11:13:17 PM3/22/12
to
On Thu, 22 Mar 2012 12:52:16 -0700 (PDT), cedarsystems wrote in
alt.msdos.batch.nt:
Is "barkb" a batch file? If so, it ought to be "call"ed.

--
Michael Bednarek "ONWARD"

foxidrive

unread,
Mar 23, 2012, 12:37:28 AM3/23/12
to
What OS are you using?

I see you are using a com port, presumably for the scanner. Does this portion return any messages from the console window? How about if you run it twice?


@echo off
cls
mode com1: 9600,n,8,1
barkb
barkbset start
pause





--
Mic

cedars...@googlemail.com

unread,
Mar 23, 2012, 2:44:55 AM3/23/12
to
OS is Win XP Pro

Barkb is a 'COM' file and Barkbset is an 'EXE'

No error messages of any kind, just doesn't want to start the scanner
from a batch file.

Worked for years without error in Win 98.

Have tried running the file twice.
Also tried duplicating each command in the file.

Just crazy that ir runs from the console but not from a batch file
that is called from the console.

Colin

foxidrive

unread,
Mar 23, 2012, 3:05:14 AM3/23/12
to
Are they actually running in task manager when the batch file is at the pause command?



--
Mic

Frank P. Westlake

unread,
Mar 23, 2012, 9:42:52 AM3/23/12
to
On 2012-03-22 15:31, cedars...@googlemail.com wrote:
> Is it possible that calling the batch file instigates a new 'Cmd'
> instance?

On 2012-03-22 23:44, cedars...@googlemail.com wrote:
> OS is Win XP Pro
>
> Barkb is a 'COM' file and Barkbset is an 'EXE'

I haven't used COMMAND.COM in 15 years but I think the COM file is going
to COMMAND.COM and the rest is processed by CMD.EXE. So your guess above
may be on track.

Try sending both the MODE and BARKB statements to COMMAND.COM. Someone
else here might suggest how.

Frank

cedars...@googlemail.com

unread,
Mar 24, 2012, 10:00:35 AM3/24/12
to
Bit of an update.

Seems that if I run C:\WINDOWS\SYSTEM32\COMMAND.COM then run the batch
file, it all works correctly.

Is there a way to run command.com with the batch file as a
'parameter'?

Colin

foxidrive

unread,
Mar 24, 2012, 10:15:53 AM3/24/12
to
:: runthis.bat
@echo off
command.com /c "my batch file.bat"


--
Mic

cedars...@googlemail.com

unread,
Mar 27, 2012, 3:30:26 AM3/27/12
to
Should have asked my last question slightly differently...

Is there a way to call "c:\windows\system32\command.com" from a
Desktop Shortcut and automatically run a Batch File?

Calling the Command.Com from the desktop is no problem but, I am
having some difficulty the running the Batch File at the same time.

Colin.

foxidrive

unread,
Mar 27, 2012, 3:40:52 AM3/27/12
to
In the executable portion of the link put in

"c:\windows\system32\command.com" /c "c:\bat\my batch file.bat"



--
Mic

cedars...@googlemail.com

unread,
Mar 27, 2012, 1:06:19 PM3/27/12
to
Hi All,

Thanks for the help. Finally cracked it.

Windows Shortcut now reads;

C:\WINDOWS\SYSTEM32\COMMAND.COM \C F:\TEST.BAT

(No Quote marks etc.)

Everything now working correctly.

Colin

Harry Vaderchi

unread,
Mar 28, 2012, 5:34:50 AM3/28/12
to
I'm glad, but surprised it works, forward slash is the standard
commandline parameter separator

%ComSpec% /C F:\TEST.BAT

should give you the extended command set

(my comspec is

ComSpec=C:\WINDOWS\system32\cmd.exe

)

--
[dash dash space newline 4line sig]

Albi CNU

Tom Lavedas

unread,
Mar 28, 2012, 10:23:54 AM3/28/12
to ad...@127.0.0.1
Forward slash and backslash have become interchangeable in recent versions of Windows - even in file pathspecs.
_______________________
Tom Lavedas

cedars...@googlemail.com

unread,
Mar 28, 2012, 10:27:57 AM3/28/12
to
It was a 'typo'.

Should have been a forward slash (/C)

Colin
0 new messages