Discussion:
Batch line to display readonly text in a window ?
(too old to reply)
John Stockton
2022-04-14 14:05:39 UTC
Permalink
I use code like the following, in batch files running in a Command Prompt window, to display the content of a freshly-written plain-text file in a normal window. From there, I selectively copy'n'paste into a Command Prompt window.

set DIFF_TXT=%LOGDIR%\$ORPHANS.TXT
REM write to $orphans.txt
start iexplore.exe %DIFF_TXT%

I don't want to continue with Internet Explorer, as it is dying.

I could use Notepad, except that I want the content of the window to be unalterable (except by scrolling and resizing; being un-saveable is irrelevant)

I could use another browser, but I chose to use Internet Explorer because I never use it otherwise at that time and I therefore get a new on-top window.

So : is there another means of displaying, from within Batch, a file in a read-only window (required for Win 10, might be wanted in Win 7 or Win 11)?

Otherwise, how/can I create a suitable window/dialog, with copy'n'paste, using VBScript?
--
(c) John Stockton, near London, UK. Using Google Groups. |
Dallas
2022-04-14 16:32:21 UTC
Permalink
Post by John Stockton
I use code like the following, in batch files running in a Command Prompt window, to display the content of a freshly-written plain-text file in a normal window. From there, I selectively copy'n'paste into a Command Prompt window.
set DIFF_TXT=%LOGDIR%\$ORPHANS.TXT
REM write to $orphans.txt
start iexplore.exe %DIFF_TXT%
I don't want to continue with Internet Explorer, as it is dying.
I could use Notepad, except that I want the content of the window to be unalterable (except by scrolling and resizing; being un-saveable is irrelevant)
I could use another browser, but I chose to use Internet Explorer because I never use it otherwise at that time and I therefore get a new on-top window.
So : is there another means of displaying, from within Batch, a file in a read-only window (required for Win 10, might be wanted in Win 7 or Win 11)?
Otherwise, how/can I create a suitable window/dialog, with copy'n'paste, using VBScript?
Interesting question!

Now i wonder that when iexplore.exe is retired as a name to invoke Internet Explorer with, will
iexplore.exe be a program to launch the currently marketed Microsoft browser ?

From
https://techcommunity.microsoft.com/t5/windows-it-pro-blog/internet-explorer-11-desktop-app-retirement-faq/ba-p/2366549
"
Will iexplore.exe be removed from devices?
No, but if a user tries to access it, they will be unable to open IE11 and will be redirected to
Microsoft Edge.
"
John Stockton
2022-04-14 22:34:30 UTC
Permalink
Post by Dallas
Post by John Stockton
set DIFF_TXT=%LOGDIR%\$ORPHANS.TXT
REM write to $orphans.txt
start iexplore.exe %DIFF_TXT%
I don't want to continue with Internet Explorer, as it is dying.
From
https://techcommunity.microsoft.com/t5/windows-it-pro-blog/internet-explorer-11-desktop-app-retirement-faq/ba-p/2366549
"
Will iexplore.exe be removed from devices?
No, but if a user tries to access it, they will be unable to open IE11 and will be redirected to
Microsoft Edge.
"
In which case, I probably don't need to do anything.

However, I do have Notepad++ - and
"C:\Program Files\Notepad++\notepad++" -ro $rajesh.txt
does what I want (and in a better font!).

But I'll see what I can get using something like
CALL WScript new_prog.vbs $rajesh.txt

Thanks to both,

--
(c) John Stockton, near London, UK. Using Google Groups. |
Dallas
2022-04-14 23:03:21 UTC
Permalink
Post by John Stockton
However, I do have Notepad++ - and
"C:\Program Files\Notepad++\notepad++" -ro $rajesh.txt
does what I want (and in a better font!).
I was thinking that you needed a solution that did not involve "not-provided" software like NP++
that you have to install.
Dallas
2022-04-14 23:21:23 UTC
Permalink
Post by Dallas
Post by John Stockton
However, I do have Notepad++ - and
      "C:\Program Files\Notepad++\notepad++" -ro $rajesh.txt
does what I want (and in a better font!).
I was thinking that you needed a solution that did not involve "not-provided" software like NP++
that you have to install.
I have used VSCode for this purpose:

type $rajesh.txt | code -
Dallas
2022-04-15 13:12:14 UTC
Permalink
dir | code -
Adding a -n switch creates a new window for the VSCode process.

dir | code - -n

Now, I want to find a way to keep VSCode from blocking the cmd.exe process.
John Stockton
2022-04-15 15:00:27 UTC
Permalink
Post by Dallas
Post by John Stockton
However, I do have Notepad++ - and
"C:\Program Files\Notepad++\notepad++" -ro $rajesh.txt
does what I want (and in a better font!).
I was thinking that you needed a solution that did not involve "not-provided" software like NP++
that you have to install.
Working Notepad++ is better that not-working IE11. But if start iexplore.exe %DIFF_TXT% opens Edge which opens %DIFF_TXT% as ReadOnly, then I actually need to do nothing. Except that Microsoft might "upgrade" Edge to be a page editor ...

In my PCs, Notepad++ is installed already <g>. But I'd prefer something already in Windows. If Notepad or Wordpad understood ReadOnly, I'd use it.

An additional requirement is compatibility with 64-bit Windows. I have the late Vernon Buerg's LIST, but cannot run it.

If I end up writing something, I might call it MIKADO. My system would automatically transfer it with my batch file.
--
(c) John Stockton, near London, UK. Using Google Groups. |
Dallas
2022-04-15 16:45:30 UTC
Permalink
Post by John Stockton
Post by Dallas
Post by John Stockton
However, I do have Notepad++ - and
"C:\Program Files\Notepad++\notepad++" -ro $rajesh.txt
does what I want (and in a better font!).
I was thinking that you needed a solution that did not involve "not-provided" software like NP++
that you have to install.
Working Notepad++ is better that not-working IE11.
But if start iexplore.exe %DIFF_TXT% opens Edge which opens %DIFF_TXT% as ReadOnly, then I actually need to do nothing.
Except that Microsoft might "upgrade" Edge to be a page editor ...
In my PCs, Notepad++ is installed already <g>. But I'd prefer something already in Windows.
If Notepad or Wordpad understood ReadOnly, I'd use it.
An additional requirement is compatibility with 64-bit Windows. I have the late Vernon Buerg's LIST, but cannot run it.
If I end up writing something, I might call it MIKADO. My system would automatically transfer it with my batch file.
I loved Vernon Buerg's LIST program.

For a while I created "bridge" scripts to allow me to use those older utilities even if all they
understood were 8.3 formatted file names. But when I switched to a 64-bit Windows I had to
regretfully leave them behind and implement PowerShell versions of some of them.
Dallas
2022-04-15 16:46:21 UTC
Permalink
Post by John Stockton
Post by Dallas
Post by John Stockton
However, I do have Notepad++ - and
"C:\Program Files\Notepad++\notepad++" -ro $rajesh.txt
does what I want (and in a better font!).
I was thinking that you needed a solution that did not involve "not-provided" software like NP++
that you have to install.
Working Notepad++ is better that not-working IE11. But if start iexplore.exe %DIFF_TXT% opens Edge which opens %DIFF_TXT% as ReadOnly, then I actually need to do nothing. Except that Microsoft might "upgrade" Edge to be a page editor ...
In my PCs, Notepad++ is installed already <g>. But I'd prefer something already in Windows. If Notepad or Wordpad understood ReadOnly, I'd use it.
An additional requirement is compatibility with 64-bit Windows. I have the late Vernon Buerg's LIST, but cannot run it.
If I end up writing something, I might call it MIKADO. My system would automatically transfer it with my batch file.
Do you have VSCode installed?
Dallas
2022-04-15 17:57:51 UTC
Permalink
Post by John Stockton
However, I do have Notepad++ - and
"C:\Program Files\Notepad++\notepad++" -ro $rajesh.txt
does what I want (and in a better font!).
Have you ever tried using the
-multiInst
parameter to Notepad++ ?

I am testing it, but not quite sure what to expect.
John Stockton
2022-04-16 12:53:21 UTC
Permalink
Post by Dallas
Post by John Stockton
However, I do have Notepad++ - and
"C:\Program Files\Notepad++\notepad++" -ro $rajesh.txt
does what I want (and in a better font!).
Have you ever tried using the
-multiInst
parameter to Notepad++ ?
I am testing it, but not quite sure what to expect.
I was unaware of it. It seems to duplicate a pre-existing Notepad++ window (if any) then open a named file (if any) in a new tab in one of the copies. If a file is open in more than one window, changes are not duplicated in the other.

--
(c) John Stockton, near London, UK. Using Google Groups. |
Dallas
2022-04-16 14:00:37 UTC
Permalink
Post by John Stockton
Post by Dallas
Post by John Stockton
However, I do have Notepad++ - and
"C:\Program Files\Notepad++\notepad++" -ro $rajesh.txt
does what I want (and in a better font!).
Have you ever tried using the
-multiInst
parameter to Notepad++ ?
I am testing it, but not quite sure what to expect.
I was unaware of it. It seems to duplicate a pre-existing Notepad++ window (if any) then open a named file (if any) in a new tab in one of the copies. If a file is open in more than one window, changes are not duplicated in the other.
--
(c) John Stockton, near London, UK. Using Google Groups. |
Thanks!

I am still playing with it, but getting inconsistent results.

I had hoped that it would open a new window with only one tab for the file I want to edit.

But sometimes it also has a tab a file I previously had open.

- Dallas
John Stockton
2022-04-16 21:54:30 UTC
Permalink
Post by Dallas
Post by Dallas
Post by John Stockton
However, I do have Notepad++ - and
"C:\Program Files\Notepad++\notepad++" -ro $rajesh.txt
does what I want (and in a better font!).
Have you ever tried using the
-multiInst
parameter to Notepad++ ?
I am testing it, but not quite sure what to expect.
I was unaware of it. It seems to duplicate a pre-existing Notepad++ window (if any) then open a named file (if any) in a new tab in one of the copies. If a file is open in more than one window, changes are not duplicated in the other.
--
(c) John Stockton, near London, UK. Using Google Groups. |
Thanks!
I am still playing with it, but getting inconsistent results.
I had hoped that it would open a new window with only one tab for the file I want to edit.
But sometimes it also has a tab a file I previously had open.
- Dallas
Press the ? at the top of Notepad++, then press Command Line Arguments ...
Site https://npp-user-manual.org/ says a great deal more.

I now have a batch file :

@echo MIKADO.BAT (c) JRS 2022-04-16+
:: Ko-Ko : "I've Got a Little List" - The Mikado - Gilbert and Sullivan
:: REM @start iexplore.exe %1
@call "C:\Program Files\Notepad++\notepad++" -ro -alwaysOnTop -nosession %1
@echo MIKADO.BAT ends.
:: End.

The Notepad++ line displays the text as I want it - - -
but MIKADO.BAT annoyingly does not resume until I close Notepad++ . ???

--
(c) John Stockton, near London, UK. Using Google Groups. |
Kerr-Mudd, John
2022-04-16 22:09:57 UTC
Permalink
On Sat, 16 Apr 2022 14:54:30 -0700 (PDT)
Post by John Stockton
Post by Dallas
Post by Dallas
Post by John Stockton
However, I do have Notepad++ - and
"C:\Program Files\Notepad++\notepad++" -ro $rajesh.txt
does what I want (and in a better font!).
Have you ever tried using the
-multiInst
parameter to Notepad++ ?
I am testing it, but not quite sure what to expect.
I was unaware of it. It seems to duplicate a pre-existing Notepad++ window (if any) then open a named file (if any) in a new tab in one of the copies. If a file is open in more than one window, changes are not duplicated in the other.
--
(c) John Stockton, near London, UK. Using Google Groups. |
Thanks!
I am still playing with it, but getting inconsistent results.
I had hoped that it would open a new window with only one tab for the file I want to edit.
But sometimes it also has a tab a file I previously had open.
- Dallas
Press the ? at the top of Notepad++, then press Command Line Arguments ...
Site https://npp-user-manual.org/ says a great deal more.
@echo MIKADO.BAT (c) JRS 2022-04-16+
:: Ko-Ko : "I've Got a Little List" - The Mikado - Gilbert and Sullivan
@call "C:\Program Files\Notepad++\notepad++" -ro -alwaysOnTop -nosession %1
@echo MIKADO.BAT ends.
:: End.
The Notepad++ line displays the text as I want it - - -
but MIKADO.BAT annoyingly does not resume until I close Notepad++ . ???
That's easily solved. Enforcing a copyright is a whole different matter. Good Luck.
--
Bah, and indeed Humbug.
Dallas
2022-04-17 00:42:14 UTC
Permalink
Post by John Stockton
Press the ? at the top of Notepad++, then press Command Line Arguments ...
Site https://npp-user-manual.org/ says a great deal more.
@echo MIKADO.BAT (c) JRS 2022-04-16+
:: Ko-Ko : "I've Got a Little List" - The Mikado - Gilbert and Sullivan
@call "C:\Program Files\Notepad++\notepad++" -ro -alwaysOnTop -nosession %1
@echo MIKADO.BAT ends.
:: End.
The Notepad++ line displays the text as I want it - - -
but MIKADO.BAT annoyingly does not resume until I close Notepad++ . ???
--
(c) John Stockton, near London, UK. Using Google Groups. |
I am trying to find a way to eliminate that block-until-close with VSCode as well.

I know how to code around it using PowerShell, but not cmd.exe
Thomas Langer
2022-04-17 13:24:26 UTC
Permalink
Post by Dallas
Post by John Stockton
--
(c) John Stockton, near London, UK. Using Google Groups. |
Thanks!
I am still playing with it, but getting inconsistent results.
I had hoped that it would open a new window with only one tab for the file I want to edit.
But sometimes it also has a tab a file I previously had open.
- Dallas
to resume your batch file after starting notepad++ replace original line
of code
@call "C:\Program Files\Notepad++\notepad++" -ro -alwaysOnTop
-nosession %1

with
start "" "C:\Program Files\Notepad++\notepad++" -ro -alwaysOnTop
-nosession %1


Regards
Thomas Langer
John Stockton
2022-04-17 21:04:48 UTC
Permalink
Post by Thomas Langer
to resume your batch file after starting notepad++ replace original line
of code
@call "C:\Program Files\Notepad++\notepad++" -ro -alwaysOnTop
-nosession %1
with
start "" "C:\Program Files\Notepad++\notepad++" -ro -alwaysOnTop
-nosession %1
YES - but I don't see why adding a blank title has the desired effect !

Thanks,

(c) John Stockton, near London, UK. Using Google Groups. |
Kenny McCormack
2022-04-17 21:33:58 UTC
Permalink
Post by John Stockton
Post by Thomas Langer
to resume your batch file after starting notepad++ replace original line
of code
@call "C:\Program Files\Notepad++\notepad++" -ro -alwaysOnTop
-nosession %1
with
start "" "C:\Program Files\Notepad++\notepad++" -ro -alwaysOnTop
-nosession %1
YES - but I don't see why adding a blank title has the desired effect !
It is a bug^H^H^Hmisfeature of the "start" command in CMD.EXE.

If you don't put the "" in there, it will just open a(nother) CMD window.
--
The randomly chosen signature file that would have appeared here is more than 4
lines long. As such, it violates one or more Usenet RFCs. In order to remain
in compliance with said RFCs, the actual sig can be found at the following URL:
http://user.xmission.com/~gazelle/Sigs/ThePublicGood
Dallas
2022-04-17 23:31:58 UTC
Permalink
Post by John Stockton
Post by Thomas Langer
to resume your batch file after starting notepad++ replace original line
of code
@call "C:\Program Files\Notepad++\notepad++" -ro -alwaysOnTop
-nosession %1
with
start "" "C:\Program Files\Notepad++\notepad++" -ro -alwaysOnTop
-nosession %1
YES - but I don't see why adding a blank title has the desired effect !
Thanks,
(c) John Stockton, near London, UK. Using Google Groups. |
You are not alone in being confused by the behavior of the START command.

The instance when I have to specify a title is when the command/program string contains spaces and
I need to wrap that string with double quotes.
Dallas
2022-04-21 17:27:34 UTC
Permalink
Post by Dallas
Post by John Stockton
Post by Thomas Langer
to resume your batch file after starting notepad++ replace original line
of code
@call "C:\Program Files\Notepad++\notepad++" -ro -alwaysOnTop -nosession %1
with
start "" "C:\Program Files\Notepad++\notepad++" -ro -alwaysOnTop
-nosession %1
YES - but I don't see why adding a blank title has the desired effect !
Thanks,
(c) John Stockton, near London, UK. Using Google Groups. |
You are not alone in being confused by the behavior of the START command.
The instance when I have to specify a title is when the command/program string contains spaces and
I need to wrap that string with double quotes.
In the particular case of

start "" "C:\Program Files\Notepad++\notepad++" -ro -alwaysOnTop

It is the space character in "Program Files" that makes it necessary to specify a Title and the
smallest Title is the empty string.

Thomas Langer
2022-04-19 05:51:42 UTC
Permalink
Post by John Stockton
Post by Thomas Langer
to resume your batch file after starting notepad++ replace original line
of code
@call "C:\Program Files\Notepad++\notepad++" -ro -alwaysOnTop
-nosession %1
with
start "" "C:\Program Files\Notepad++\notepad++" -ro -alwaysOnTop
-nosession %1
YES - but I don't see why adding a blank title has the desired effect !
Thanks,
(c) John Stockton, near London, UK. Using Google Groups. |
The command START without the argument /WAIT starts a program in a new
process. Using START instead of CALL gives the desired result.

In earlier Windows versions START seemed to have a bug if the argument
"TITLE" had been omitted. To work around this bug it became usual to
call START with an empty "TITLE", but in current versions START does run
without "TITLE", tested with [version 10.0.19043.1645]

As I do not know your environment I gave you the syntax known as to work
for sure.
Kenny McCormack
2022-04-14 17:47:34 UTC
Permalink
In article <96fcfa8a-9948-4474-bda9-***@googlegroups.com>,
John Stockton <***@gmail.com> wrote:
...
Post by John Stockton
I could use another browser, but I chose to use Internet Explorer because I never
use it otherwise at that time and I therefore get a new on-top window.
So : is there another means of displaying, from within Batch, a file in a
read-only window (required for Win 10, might be wanted in Win 7 or Win 11)?
Otherwise, how/can I create a suitable window/dialog, with
copy'n'paste, using VBScript?
Invoking a browser just to display text is the proverbial overkill
(something about smashing ants with a sledgehammer). But you probably
already know that.

I suppose the overall goal is to avoid doing any programming, but it sure
doesn't seem like it would be very hard to knock something together in VB
or some variation thereof. I think there is even an example code for this
in the TCC (tiny C compiler) distro for Windows.

Or, you could use WSL and then use xmessage...

(That's how I do this sort of thing mostly nowadays, but, of course, under
Linux, not Windows)
--
Many North Koreans believe Kim-il-Sung is an "almighty god" who "created
the world" in seven days as a divine spirit millions of years ago, and
came to Earth as a human in 1912 as a messianic figure.
Marble2
2022-04-14 23:02:23 UTC
Permalink
Post by John Stockton
I use code like the following, in batch files running in a Command
Prompt window, to display the content of a freshly-written
plain-text file in a normal window. From there, I selectively
copy'n'paste into a Command Prompt window.
set DIFF_TXT=%LOGDIR%\$ORPHANS.TXT
REM write to $orphans.txt
start iexplore.exe %DIFF_TXT%
I don't want to continue with Internet Explorer, as it is dying.
I could use Notepad, except that I want the content of the window
to be unalterable (except by scrolling and resizing; being
un-saveable is irrelevant)
I could use another browser, but I chose to use Internet Explorer
because I never use it otherwise at that time and I therefore get
a new on-top window.
So : is there another means of displaying, from within Batch, a
file in a read-only window (required for Win 10, might be wanted
in Win 7 or Win 11)?
Otherwise, how/can I create a suitable window/dialog, with
copy'n'paste, using VBScript?
If you like your browser solution, rename the file with an html file
extension and try "start yourfile.html". It should open in your
default browser.
John Stockton
2022-04-15 14:06:05 UTC
Permalink
Post by Marble2
Post by John Stockton
I use code like the following, in batch files running in a Command
Prompt window, to display the content of a freshly-written
plain-text file in a normal window. From there, I selectively
copy'n'paste into a Command Prompt window.
If you like your browser solution, rename the file with an html file
extension and try "start yourfile.html". It should open in your
default browser.
I do not want it to open in an already-running application - using a new one makes it much easier to find the new window.
--
(c) John Stockton, near London, UK. Using Google Groups. |
Adam Lubszczyk
2022-04-15 10:49:56 UTC
Permalink
If You have a Total Commander try

....\TOTALCMD.EXE /s=l C:\PATH\FILE.TXT


Adam
JJ
2022-04-15 10:52:21 UTC
Permalink
Post by John Stockton
I use code like the following, in batch files running in a Command Prompt window, to display the content of a freshly-written plain-text file in a normal window. From there, I selectively copy'n'paste into a Command Prompt window.
set DIFF_TXT=%LOGDIR%\$ORPHANS.TXT
REM write to $orphans.txt
start iexplore.exe %DIFF_TXT%
I don't want to continue with Internet Explorer, as it is dying.
I could use Notepad, except that I want the content of the window to be unalterable (except by scrolling and resizing; being un-saveable is irrelevant)
I could use another browser, but I chose to use Internet Explorer because I never use it otherwise at that time and I therefore get a new on-top window.
So : is there another means of displaying, from within Batch, a file in a read-only window (required for Win 10, might be wanted in Win 7 or Win 11)?
Otherwise, how/can I create a suitable window/dialog, with copy'n'paste, using VBScript?
You can use HTML Application. The command line is pretty long, so it's in
Pastebin.

https://pastebin.com/GGSFdbG7
Loading...