Listc - a modern Windows file explorer/viewer in the console window

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
misol101
Posts: 381
Joined: 02 May 2016 18:20

Listc - a modern Windows file explorer/viewer in the console window

#1 Post by misol101 » 02 Sep 2017 05:18

Image

Wait!? This looks awfully familiar
That's right, it's a clone of Listb (viewtopic.php?t=7147), but Listc is remade and optimized for Win10/modern machines. Running listb on a Win10 machine was just painfully slow when I tried it, but this one runs well.

What is it?
Listc is a file explorer to browse/view/copy etc files inside the console window. It is also easy to extend with added funtionality building on the separate extendlistc.bat.

Where is it?
Here: http://www.mediafire.com/file/a5134mw39b8228d/listc.zip.

What are the requirements?
If you want to be able to run the script from any folder (when already in a cmd window), you should put all the files in a PATH folder. If not, you are good to go.

It is highly recommended to run listc by running l.bat. The arguments to l.bat are the same as for listc.bat, but if arguments are not given, it does a better job of setting up the environment automatically. It also enables the custom addon commands in extendlistc.bat.

What are the arguments to Listc/l.bat?
listc [path] [width] [height] [-][columns] [extend_path\name] [mouse]

[path] specifies which folder to start in. If not specified, this is ".", the current folder
[width] Number of columns
[rows] Number of rows
[columns] Number of file columns used (this can be changed while running by pressing 1-9). A negative value enables adaptive columns, and the number then represents the maximum number of columns.
[extend_path\name] Path to optional script with extended functionality for Listc (this can be either an ABOLUTE path, or a PATH folder using the syntax for that). extendlistc.bat is included, and is pointed to by l.bat by assuming it is in a PATH folder.
[mouse] if this argument is "Y", then mouse support is enabled (you can click on files to go there, doubleclick to view it, right doubleclick to run/invoke it)

Do I need to edit something before running l.bat?

The default view and edit commands are set to work for everyone at first, but I personally prefer other options. The default is to use "more" to view files, and "notepad" to edit them. I prefer to use less for view and b.exe for editing. To change this, open extendlistc.bat and search for "SETVIEWERS". Then change them to whatever you would like to use. Also, the default external viewer is set to 'less'. If it is not installed on your machine, you have to change it to something else (like more?)

Also note that extendlistc.bat is an example of custom addons, and thus, it uses a bunch of external programs. If you don't have those programs, you need to either install them or change/remove these commands (the ones used are: less, grep, my script g.bat (see another thread), dlc.exe, ansicon, unzip, zip)

What functionality does Listc have?
Press F1 or ? to see what keys are available. Most of it is centered around copying/moving/deleting one or more files (select several files with Space), but there is plenty of other functionality too, like running/showing files with 'i'.

What are the limitations?
Things get rather slow when there are a lot of files in a folder. Also, I would not be surprised if there are remaining issues with some special characters and/or spaces in file/folder names.
Last edited by misol101 on 04 Sep 2017 02:46, edited 5 times in total.

misol101
Posts: 381
Joined: 02 May 2016 18:20

Re: Listc - a modern Windows file explorer/viewer in the console window

#2 Post by misol101 » 02 Sep 2017 05:22

What's the difference compared to listb?

Well, apart from the fact that it runs at a reasonable speed on Win10 machines instead of snail pace, the major difference is that written input to the script is received from a separate (popup) cmd window.

Why? Well, getting reasonable performance out of this script on Win10, I (again) had to run it with cmdgfx as input/output server. Since stdin is hooked by cmdgfx_input, it's not possible to get input with a simple SET /p in the same window. Thus, opening a second window for input is necessary.

misol101
Posts: 381
Joined: 02 May 2016 18:20

Re: Listc - a modern Windows file explorer/viewer in the console window

#3 Post by misol101 » 02 Sep 2017 10:08

Ok, that was a bit fast. Fixed a few things, updated archive.

1. Now quits properly
2. Shows path and path-number in top bar
3. The x key works again

siberia-man
Posts: 126
Joined: 26 Dec 2013 09:28
Contact:

Re: Listc - a modern Windows file explorer/viewer in the console window

#4 Post by siberia-man » 03 Sep 2017 03:17

You seemed reinvented Norton Commander in the essentially lightened mode. :-) As the toy or example of crazy programming, it could exist. Seriously!

One this I could point. Put the following lines in the beginning of listc\l.bat script. It automates putting the location of the script and other auxiliary commands in the %PATH%.

Code: Select all

for %%p in ( "%PATH:;=" "%" ) do if "%%~p\." == "%~dp0." goto :no_set_path
set "Path=%Path%;%~dp0"
:no_set_path

misol101
Posts: 381
Joined: 02 May 2016 18:20

Re: Listc - a modern Windows file explorer/viewer in the console window

#5 Post by misol101 » 03 Sep 2017 05:23

siberia-man wrote:One this I could point. Put the following lines in the beginning of listc\l.bat script. It automates putting the location of the script and other auxiliary commands in the %PATH%.

Code: Select all

for %%p in ( "%PATH:;=" "%" ) do if "%%~p\." == "%~dp0." goto :no_set_path
set "Path=%Path%;%~dp0"
:no_set_path

Thanks, that's pretty clever! I will add that to the script, though personally I prefer to be able to run l.bat from a cmd window starting from any folder I am currently in, in which case the files would still have to be in a PATH folder. But as long as one is ok with always starting l.bat from its own folder then your solution works great!

Edit: updated archive to include your change

misol101
Posts: 381
Joined: 02 May 2016 18:20

Re: Listc - a modern Windows file explorer/viewer in the console window

#6 Post by misol101 » 03 Sep 2017 06:12

Somebody asked if it's possible to change drive.

Yes, press '/' and type e.g. e: to see the e drive if available.

Also note that it's possible to switch between the two available path screens by pressing 'y'

misol101
Posts: 381
Joined: 02 May 2016 18:20

Re: Listc - a modern Windows file explorer/viewer in the console window

#7 Post by misol101 » 03 Sep 2017 07:49

Archive updated.

Better handling of special characters in the names in the list (like &), and details mode (the + key) works again.
Last edited by misol101 on 22 Mar 2018 10:48, edited 1 time in total.

misol101
Posts: 381
Joined: 02 May 2016 18:20

Re: Listc - a modern Windows file explorer/viewer in the console window

#8 Post by misol101 » 15 Mar 2018 14:10

Archive was updated since a few small but important fixes were made.

Listc doesn't read servercmd.dat any longer, which prevents possible sudden shutdowns when running other cmdgfx scripts from within listc.
Cmdgfx_input no longer waits in a busy-loop, ie it will no longer eat huge amounts of CPU if not being used.


Edit: One thing I'd like to point out is that to be useful, Listc (or actually, l.bat) is meant to be run from an existing cmd window. Running it from explorer (from the folder it was installed) is of course possible, but essentially quite useless. The point of Listc is that it can be run in the current folder in the current cmd window writing a simple "l", and that's when it gets useful.

misol101
Posts: 381
Joined: 02 May 2016 18:20

Re: Listc - a modern Windows file explorer/viewer in the console window

#9 Post by misol101 » 22 Jul 2019 06:48

Updated archive of this oldie-but-goldie in order to support resizing of the window. In other words, the file list will now respond to any size changes of the cmd window it runs in, and it will also run properly in Fullscreen (Alt-Enter, or Ctrl-Enter for Windows 7)

carlos
Expert
Posts: 489
Joined: 20 Aug 2010 13:57
Location: Chile
Contact:

Re: Listc - a modern Windows file explorer/viewer in the console window

#10 Post by carlos » 22 Jul 2019 18:28

Hello misol. Nice terminal user interface.
Your program remembered me a recent discovery : an old software called List Enhanced: http://bit.ly/2OaqX6p

It seems was a very popular software in the 80-90's.

But is nice about how you can explore the content of a file. More good than see the content with the more command. You can use the arrows for explore inside the file. Maybe a good feature for your listc program.

Also I like so much the interface of the old dosshell.exe but seems hard to reprogramming it using a character window.

Carlos.

misol101
Posts: 381
Joined: 02 May 2016 18:20

Re: Listc - a modern Windows file explorer/viewer in the console window

#11 Post by misol101 » 31 Jul 2019 05:40

Hi Carlos,

yes List for DOS by Vernon D. Buerg was actually precisely the inspiration for my List program, as is also mentioned in the first post of this thread: viewtopic.php?f=3&t=7147

This is also evident if you compare key shortcuts in these programs, as I took many of them straight from List as I already had them memorized (ie. q/x to quit, e to edit, i to invoke, ? to see help etc)

I don't run Dosbox though, so that's why I wanted to make this batch script version because I missed browsing around in the cmd window (and I never quite liked Norton Commander)

As for exploring the contents of file, I agree that more isn't the best option, I just chose it because it is available for everyone. You can configure my script to use any program to look at or edit files. If you start listc using l.bat, then it automatically looks for extensions inside extendlistc.bat. I have personally set it to:

Code: Select all

:SETVIEWERS
set VIEWCMD=less -f
set EDITCMD=start "" "C:\Program Files\Notepad++\Notepad++.exe"
which will use less to view the currently selected file if you press Enter, and Notepad++ if you press 'e'.

For convenient binary/hex viewing and editing, I have personally added another button 'h' and using HxD inside extendlistc.bat, like:

Code: Select all

if %LKEY% == "h" if not "!FT%CURRPOS%!"=="/" cmd /C start "" "C:\Program Files\HxD\HxD.exe" !FO%CURRPOS%!
Listc is quite easy to extend by editing extendlistc.bat! :)

misol101
Posts: 381
Joined: 02 May 2016 18:20

Re: Listc - a modern Windows file explorer/viewer in the console window

#12 Post by misol101 » 15 Aug 2019 08:23

Updated the archive again because I messed up and reverted two fixes:

1. Listc doesn't read servercmd.dat any longer, which prevents possible sudden shutdowns when running other cmdgfx scripts from within listc.
2. Cmdgfx_input no longer waits in a busy-loop, ie it will no longer eat huge amounts of CPU if not being used.

Sorry about that, now fixed. Redownload the archive, OR fix both these problems yourself, by changing this line in listc.bat:

Code: Select all

cmdgfx_input.exe m0W12R | call %0 %* | cmdgfx.exe "fbox u U 20" Se
into:

Code: Select all

cmdgfx_input.exe miR | call %0 %* | cmdgfx.exe "fbox u U 20" Sei

Post Reply