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

Pipes and Win95cmd custom DVM - a workaround

2 views
Skip to first unread message

William Allen

unread,
Mar 15, 2002, 5:07:10 PM3/15/02
to
======Pipes and Win95cmd custom DVM

Most uses of Win95cmd.exe, the free Microsoft Batch enhancer
(see Note 1 below about what it is and where to get it) involve running
a few instructions in a temporary command shell from a COMMAND.COM
hosted Batch file.

However, for study purposes, a simple Custom DVM in Windows 9x
running Win95cmd.exe as the DVM shell is useful for learning about
Win95cmd, and, effectively studying the advanced Batch language
provided in Windows 2000 from a Windows 9x machine. However,
in a custom Win95cmd DVM, pipes don't work directly. But a simple
workaround (explained below) enables you to use them.

This article updates previous material we've published on Win95cmd.
It first explains (1) how to create a Win95cmd custom DVM and
then (2) demonstrates a simple pipe workaround.

===1) This is how to install a Win95cmd custom DVM

(a) Place Win95cmd.exe in, say, your Windows folder: C:\WINDOWS
Then, create a normal Windows 95/98/ME custom DVM as follows:
(b) Right-click on blank area of Desktop and click "New"
(c) Click "Shortcut"
(d) Fill in the command line box with C:\WINDOWS\COMMAND.COM
(e) Click Next, fill in name: Win95Cmd Custom DVM, click "Finish"
(f) With Explorer, make a working folder, say C:\WRK2
(g) In say, C:\WINDOWS\COMMAND folder, create a Batch file
====Start cut-and-paste (omit this line)
@ECHO OFF
C:\WINDOWS\WIN95CMD.EXE /k CLS
====End cut-and-paste (omit this line)
Call the file C:\WINDOWS\COMMAND\WIN95CMD.BAT

(h) Right click the Win95Cmd Custom DVM shortcut, and click "Properties"
(i) In Program Tab, in field "Working" enter your new folder
(whatever you called it, say C:\WRK2)
(j) In Program Tab, in field "Batch file" enter the specification
of the small WIN95CMD.BAT batch file you created:
C:\WINDOWS\COMMAND\WIN95CMD.BAT
(k) In the Miscellaneous Tab of the shortcut, "Other" section,
make sure "Fast pasting" is unchecked. This allows normal pasting
to the WIN95CMD DVM, which is obviously necessary for quick
learning. This enables cut-and-paste to the Win95cmd window in
the usual way.
(l) In the Memory Tab, in the Initial Environment box pull-down you
may as well set, say, 2048 bytes initial environment space.

===2) Workaround to use pipes in Win95cmd custom DVM

Working in the Win95cmd custom DOS box, a normal direct
pipe operation won't work. So, for example you can't use the
win95cmd DIR command and pipe the result directly through FIND.

However, if you shell to win95cmd/c for the DIR you can pipe the
result through, say FIND, and get an ERRORLEVEL in the current
shell, despite the fact that the current shell is also a Win95cmd
shell. This means you can check the %ERRORLEVEL% variable.

This shows the problem, and the resolution.

============Screen capture Windows 95 in a Win95cmd custom DVM
C:\WRK2>ver

Microsoft Windows 2000 [Version 4.00.0000]

C:\WRK2>ECHO.Test file>TESTFILE.TXT

C:\WRK2>REM A direct pipe won't work

C:\WRK2>dir testfile.txt /4 | find /i "testfile"
Bad command or file name

C:\WRK2>REM But execute the DIR in a child win95cmd shell and a pipe will work

C:\WRK2>win95cmd /c dir testfile.txt /4 | find /i "testfile"
15/03/2002 21:50 11 TESTFILE.TXT

C:\WRK2>echo.%errorlevel%
0

C:\WRK2>win95cmd /c dir testfile.txt /4 | find /i "textfile"

C:\WRK2>echo.%errorlevel%
1

C:\WRK2>
============End screen capture

(Note: the /4 switch enables 4-digit years in DIR display.)

--
(pp) William Allen

Note 1
Win95cmd.exe is a free Microsoft batch enhancer for Windows 95/98/ME
users who are interested in learning and using some of the enhanced
batch language features in Win2000 (similar enhanced Batch features
are present in Windows XP). The worthwhile advantage of using Win95cmd
over idiosyncratic third-party Batch utilities is that it enables you
to learn and use (in Windows 9x) elements of the Batch syntax that
apply to Win2000 and WinXP should you go on to use/learn those OSes.

Win95cmd.exe file is available free as a single small ZIP from:
http://www.neuro.gatech.edu/users/cwilson/cygutils/unversioned/consize/

For most of the uses illustrated in our posts it merely needs to be
placed in a folder in the system PATH, for example C:\WINDOWS
or C:\WINDOWS\COMMAND

For general information about using it in Windows 95/98/ME and
syntax examples, see post:

Win95cmd Batch enhancer for Windows 95/98/ME users
http://groups.google.com/groups?selm=a04ecl$isbjh$1...@ID-55970.news.dfncis.de
Date: 23 Dec 2001

and for use of Win95cmd in Batch arithmetic, see post:
Batch arithmetic with the Win95cmd Batch enhancer
http://groups.google.com/groups?selm=9vdkh4$efe02$1...@ID-55970.news.dfncis.de
Date: 14 Dec 2001


William Allen

unread,
Mar 16, 2002, 5:38:30 AM3/16/02
to
"William Allen" wrote in message
...snip

> ======Pipes and Win95cmd custom DVM

Moreover, it appears that this method of enabling pipes in a Custom
Win95cmd DVM does _not_ create the usual transient pipe files in
the TEMP folder. So it does appear that the Windows 2000 memory
pipe method _can_ be enabled in Windows 95.

1) This shows how to see the transient files in a normal COMMAND.COM
pipe operation.

============Screen capture Windows 95 normal COMMAND.COM DVM
C:\WORK>REM Empty the TEMP folder

C:\WORK>deltree /y %TEMP%.\*.*>NUL

C:\WORK>REM Create file in TEMP (as a marker in what follows)>%TEMP%.\FILEONE

C:\WORK>dir %temp% /b
FILEONE

C:\WORK>ECHO. Create file TEST.TXT in current folder>TEST.TXT

C:\WORK>REM Pipe a DIR listing through FIND

C:\WORK>dir TEST.TXT | find "TEST"
TEST TXT 41 16/03/02 10:01 TEST.TXT

C:\WORK>REM Re-run pipe, this time listing the two transient pipe files

C:\WORK>dir TEST.TXT | find "TEST" | dir %temp% /b
FILEONE
AKABBIBN
AKABBICC

C:\WORK>REM Show that the two pipe files have now gone

C:\WORK>dir %temp% /b
FILEONE

C:\WORK>
============End screen capture

2) This appears to show that they are not created in a Win95cmd pipe

============Screen capture Windows 95 in custom Win95cmd DVM
C:\WRK2>ver

Microsoft Windows 2000 [Version 4.00.0000]

C:\WRK2>command /c ver

Windows 95. [Version 4.00.1111]


C:\WRK2>REM Make sure TEMP is empty

C:\WRK2>deltree /y %temp%.\*.*

C:\WRK2>ECHO. Create file in TEMP (as a marker)>%temp%.\FILEONE

C:\WRK2>dir %temp% /b
FILEONE

C:\WRK2>ECHO. Create file TEST.TXT in current folder>TEST.TXT

C:\WRK2>REM Pipe a DIR listing through FIND

C:\WRK2>win95cmd /c dir TEST.TXT | find "TEST"
16/03/02 10:14 41 TEST.TXT

C:\WRK2>REM Re-run pipe, listing any transient pipe files created

C:\WRK2>win95cmd /c dir TEST.TXT | find "TEST" | command /c dir %temp% /b
FILEONE

C:\WRK2>REM No transient pipe files!

C:\WRK2>
============End screen capture

You can also show the difference by SETting TEMP to A: with
no disk in A: - then a pipe in a normal COMMAND.COM DVM
such as ECHO. A | find "A" tries to access the floppy before
using current folder (you hear the floppy motor start)

However, with TEMP SET to A: in a Custom Win95cmd DVM,
if you then run the equivalent pipe:
win95cmd /c ECHO. A | find "A"
the pipe works without any attempt to start the floppy motor.
This seems to confirm that Win95cmd pipes can be enabled
and that they continue to work differently from normal Win9x pipes.

--
(pp) William Allen


0 new messages