• Count files & Progress Bar

    From dancer79uk@dancer79uk@gmail.com to comp.os.msdos.misc on Sun Nov 12 14:54:02 2023
    From Newsgroup: comp.os.msdos.misc

    I'm trying to get a percentage complete function for copying the Windows 98 setup files to hard disk. For this, I'm using DOS from a Windows 98 boot disk. I'd like to be able to count the number of files in the WIN98 folder on the Windows 98 CD and put this into a variable. I'm using this but it won't work:
    dir /a:-d "%cdrom%\WIN98" | find /c ":\" > tempFile.txt
    SET /p FilesCount=<tempFile.txt
    ECHO There are %FilesCount% in the folder.
    It doesn't display the FilesCount variable. The tempfile.txt file does have the number in it, in this case 102, but it won't display it (it's just a blank). Is it because it's for a later version of Windows? I'd like to get this for a percentage complete function that is coded like this (this was found after a StartPage search and looks like what I'm after):
    -------------------------------------------------
    @echo off&color a
    setlocal enabledelayedexpansion
    cd /
    mkdir ZZZDestination
    set startdir="C:\ZZZSource\Depth1\Depth2\the files"
    set enddir="C:\ZZZDestination\"
    echo.
    echo Press any key to continue
    PAUSE>nul
    for /f "tokens=1,2,3,4,5" %%a in ('dir /s %startdir%^|findstr bytes') do if /i not "%%e"=="free" set qtyfiles=%%a
    set filecount=0
    for /f "tokens=*" %%a in ('dir /a-d-h-s /s /b %startdir%') do (
    xcopy /z /q /s /e /y "%%a" "%enddir%\%%~pa\*.*" >nul
    set /a filecount=!filecount!+1
    set /a percentage=!filecount!*100 / !qtyfiles!
    cls
    echo.
    echo Copying files, PLEASE DO NOT CLOSE THIS WINDOW
    echo ======================================================
    echo Please wait for copying: !percentage!%% Completed
    echo ======================================================
    )
    echo.
    echo DONE, please press any key to exit..
    PAUSE>nul
    ----------------------------------------------------------------
    I believe that this code will only work in later versions of Windows. I would be using COPY and not XCOPY to copy the Windows 98 setup files to hard disk (although XCOPY could be used)
    I'm not a programmer and can barely understand the above batch code but would like to be to get it to work in a Windows 98 DOS environment. I don't think I need the first part for %qtyfiles% as I would already have this as %FilesCount%
    Thanks in advance to anyone that might be able to help.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From JJ@jj4public@outlook.com to comp.os.msdos.misc on Mon Nov 13 14:02:48 2023
    From Newsgroup: comp.os.msdos.misc

    On Sun, 12 Nov 2023 14:54:02 -0800 (PST), dancer79uk wrote:
    I'm trying to get a percentage complete function for copying the Windows 98 setup files to hard disk. For this, I'm using DOS from a Windows 98 boot disk. I'd like to be able to count the number of files in the WIN98 folder on the Windows 98 CD and put this into a variable. I'm using this but it won't work:

    dir /a:-d "%cdrom%\WIN98" | find /c ":\" > tempFile.txt
    SET /p FilesCount=<tempFile.txt
    ECHO There are %FilesCount% in the folder.

    It doesn't display the FilesCount variable. The tempfile.txt file does have the number in it, in this case 102, but it won't display it (it's just a blank). Is it because it's for a later version of Windows? I'd like to get this for a percentage complete function that is coded like this (this was found after a StartPage search and looks like what I'm after):

    -------------------------------------------------

    @echo off&color a
    setlocal enabledelayedexpansion

    cd /
    mkdir ZZZDestination
    set startdir="C:\ZZZSource\Depth1\Depth2\the files"
    set enddir="C:\ZZZDestination\"

    echo.
    echo Press any key to continue
    PAUSE>nul

    for /f "tokens=1,2,3,4,5" %%a in ('dir /s %startdir%^|findstr bytes') do if /i not "%%e"=="free" set qtyfiles=%%a
    set filecount=0
    for /f "tokens=*" %%a in ('dir /a-d-h-s /s /b %startdir%') do (
    xcopy /z /q /s /e /y "%%a" "%enddir%\%%~pa\*.*" >nul
    set /a filecount=!filecount!+1
    set /a percentage=!filecount!*100 / !qtyfiles!
    cls
    echo.
    echo Copying files, PLEASE DO NOT CLOSE THIS WINDOW
    echo ======================================================
    echo Please wait for copying: !percentage!%% Completed
    echo ======================================================
    )
    echo.
    echo DONE, please press any key to exit..
    PAUSE>nul

    ----------------------------------------------------------------

    I believe that this code will only work in later versions of Windows. I would be using COPY and not XCOPY to copy the Windows 98 setup files to hard disk (although XCOPY could be used)

    I'm not a programmer and can barely understand the above batch code but would like to be to get it to work in a Windows 98 DOS environment. I don't think I need the first part for %qtyfiles% as I would already have this as %FilesCount%

    Thanks in advance to anyone that might be able to help.

    Your batch file command use CMD.EXE syntax.
    Windows 9x/ME Command Prompt is COMMAND.COM. CMD.EXE is Windows NT.

    i.e. COMMAND.COM does not support:

    color
    for /f
    if /i
    set /a
    set /p
    setlocal

    Including command grouping using parentheses.

    Also, don't mix *nix file system syntax with DOS/Windows. Use `\`. Not `/`.

    If you want better command interpreter, use 4DOS. 4DOS has features which
    CMD provides, but it's not 100% compatible with CMD in both syntax and behaviour.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From dancer79uk@dancer79uk@gmail.com to comp.os.msdos.misc on Mon Nov 13 03:43:36 2023
    From Newsgroup: comp.os.msdos.misc

    On Monday, 13 November 2023 at 07:02:53 UTC, JJ wrote:
    On Sun, 12 Nov 2023 14:54:02 -0800 (PST), dancer79uk wrote:
    I'm trying to get a percentage complete function for copying the Windows 98 setup files to hard disk. For this, I'm using DOS from a Windows 98 boot disk. I'd like to be able to count the number of files in the WIN98 folder on the Windows 98 CD and put this into a variable. I'm using this but it won't work:

    dir /a:-d "%cdrom%\WIN98" | find /c ":\" > tempFile.txt
    SET /p FilesCount=<tempFile.txt
    ECHO There are %FilesCount% in the folder.

    It doesn't display the FilesCount variable. The tempfile.txt file does have the number in it, in this case 102, but it won't display it (it's just a blank). Is it because it's for a later version of Windows? I'd like to get this for a percentage complete function that is coded like this (this was found after a StartPage search and looks like what I'm after):

    -------------------------------------------------

    @echo off&color a
    setlocal enabledelayedexpansion

    cd /
    mkdir ZZZDestination
    set startdir="C:\ZZZSource\Depth1\Depth2\the files"
    set enddir="C:\ZZZDestination\"

    echo.
    echo Press any key to continue
    PAUSE>nul

    for /f "tokens=1,2,3,4,5" %%a in ('dir /s %startdir%^|findstr bytes') do if /i not "%%e"=="free" set qtyfiles=%%a
    set filecount=0
    for /f "tokens=*" %%a in ('dir /a-d-h-s /s /b %startdir%') do (
    xcopy /z /q /s /e /y "%%a" "%enddir%\%%~pa\*.*" >nul
    set /a filecount=!filecount!+1
    set /a percentage=!filecount!*100 / !qtyfiles!
    cls
    echo.
    echo Copying files, PLEASE DO NOT CLOSE THIS WINDOW
    echo ======================================================
    echo Please wait for copying: !percentage!%% Completed
    echo ======================================================
    )
    echo.
    echo DONE, please press any key to exit..
    PAUSE>nul

    ----------------------------------------------------------------

    I believe that this code will only work in later versions of Windows. I would be using COPY and not XCOPY to copy the Windows 98 setup files to hard disk (although XCOPY could be used)

    I'm not a programmer and can barely understand the above batch code but would like to be to get it to work in a Windows 98 DOS environment. I don't think I need the first part for %qtyfiles% as I would already have this as %FilesCount%

    Thanks in advance to anyone that might be able to help.
    Your batch file command use CMD.EXE syntax.
    Windows 9x/ME Command Prompt is COMMAND.COM. CMD.EXE is Windows NT.

    i.e. COMMAND.COM does not support:

    color
    for /f
    if /i
    set /a
    set /p
    setlocal

    Including command grouping using parentheses.

    Also, don't mix *nix file system syntax with DOS/Windows. Use `\`. Not `/`.

    If you want better command interpreter, use 4DOS. 4DOS has features which CMD provides, but it's not 100% compatible with CMD in both syntax and behaviour.
    Thanks for the reply. I thought it may have something to do with the version of Windows involved. I guess my question now is can the above be accomplished with COMMAND.COM?
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From JJ@jj4public@outlook.com to comp.os.msdos.misc on Tue Nov 14 09:23:16 2023
    From Newsgroup: comp.os.msdos.misc

    On Mon, 13 Nov 2023 03:43:36 -0800 (PST), dancer79uk wrote:

    Thanks for the reply. I thought it may have something to do with the
    version of Windows involved. I guess my question now is can the above be accomplished with COMMAND.COM?

    Not possible with COMMAND.COM.
    COMMAND.COM doesn't have the ability to parse output and do math.
    You'll have to use separate tools for that.
    But considering that, separate tools are needed, might as well use only one tool which has all of the needed capabilities, which is 4DOS.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From R.Wieser@address@is.invalid to comp.os.msdos.misc on Tue Nov 14 07:52:16 2023
    From Newsgroup: comp.os.msdos.misc

    JJ,

    might as well use only one tool which has all of the needed
    capabilities, which is 4DOS.

    Thats a full replacment of command.com, not a tool to be used with it. If replacement is sought for he could as well use cmd.exe. :-)

    But, in the case some DOS way (running on a command.com prompt) is needed
    the OP could to worse than to look at some yester-years BASIC variants - it offers a lot of freedom to create whatever you like. All of them include
    math and, superior to BATCH, string-handling. And yes, that even goes for
    the likes of GWBasic - even though IIRC that one uses line numbers (yuck).

    I'm particular to QBASIC, which I got with my installment of DOS 5.0 (and
    took it with me thru the years and is now used on my XP machine).

    @OP
    Seeing that you started with a script which doesn't work for a command.com based environment it might be a good idea to mention which OS and version thereof the script is supposed to be running on. Suggestions to what tools you could/can use depend on it.

    Regards,
    Rudy Wieser


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From dancer79uk@dancer79uk@gmail.com to comp.os.msdos.misc on Tue Nov 14 14:04:32 2023
    From Newsgroup: comp.os.msdos.misc

    On Tuesday, 14 November 2023 at 06:52:31 UTC, R.Wieser wrote:
    JJ,
    might as well use only one tool which has all of the needed
    capabilities, which is 4DOS.
    Thats a full replacment of command.com, not a tool to be used with it. If replacement is sought for he could as well use cmd.exe. :-)

    But, in the case some DOS way (running on a command.com prompt) is needed the OP could to worse than to look at some yester-years BASIC variants - it offers a lot of freedom to create whatever you like. All of them include math and, superior to BATCH, string-handling. And yes, that even goes for the likes of GWBasic - even though IIRC that one uses line numbers (yuck).

    I'm particular to QBASIC, which I got with my installment of DOS 5.0 (and took it with me thru the years and is now used on my XP machine).

    @OP
    Seeing that you started with a script which doesn't work for a command.com based environment it might be a good idea to mention which OS and version thereof the script is supposed to be running on. Suggestions to what tools you could/can use depend on it.

    Regards,
    Rudy Wieser
    I'm going to have a closer look at 4DOS in the next coming days. If it does the CMD stuff, I will try it out. This isn't for anything startling, it's just that when the either the Windows 95, 98 or ME setup files are being copied from the CD to hard disk for a Windows installation, instead of a please wait prompt that I'm using now, it will display a pecentage so that you how far the copying has done. It's being done from a modified Windows 98 boot disk. As said, the above script that I found a few days ago looks like what I'm looking for and thought I could use that.
    I take it that CMD.EXE can't be used on a COMMAND.COM based boot disk?
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From JJ@jj4public@outlook.com to comp.os.msdos.misc on Wed Nov 15 08:26:14 2023
    From Newsgroup: comp.os.msdos.misc

    On Tue, 14 Nov 2023 14:04:32 -0800 (PST), dancer79uk wrote:

    I take it that CMD.EXE can't be used on a COMMAND.COM based boot disk?

    CMD is a 32-bit Windows program. It can't run in pure DOS.

    If it's run in pure DOS, it'll simply display this message:

    This program cannot be run in DOS mode.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From R.Wieser@address@is.invalid to comp.os.msdos.misc on Wed Nov 15 07:53:33 2023
    From Newsgroup: comp.os.msdos.misc

    dancer,

    I take it that CMD.EXE can't be used on a COMMAND.COM based boot disk?

    Alas, no (that was what the smiley was about).

    instead of a please wait prompt that I'm using now, it will display a pecentage
    so that you how far the copying has done

    I know what you mean, waiting for something to finish without any indication that anything is going on is ... less than pleasant.

    Maybe you could go for something simpler, like just outputting the name of
    the file thats copied ? You won't know how many files still need to be copied, but you than are able to see the progression.

    You could ofcourse also do a google for some yester-years commandline
    copying program which includes a progressbar. Like perhaps this one :

    https://www.bootablecd.de/downloads/dosprog/zcopy/zcopy35.zip

    Regards,
    Rudy Wieser


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From dancer79uk@dancer79uk@gmail.com to comp.os.msdos.misc on Fri Nov 17 15:54:26 2023
    From Newsgroup: comp.os.msdos.misc

    On Wednesday, 15 November 2023 at 06:54:20 UTC, R.Wieser wrote:
    dancer,
    I take it that CMD.EXE can't be used on a COMMAND.COM based boot disk?
    Alas, no (that was what the smiley was about).
    instead of a please wait prompt that I'm using now, it will display a pecentage
    so that you how far the copying has done
    I know what you mean, waiting for something to finish without any indication that anything is going on is ... less than pleasant.

    Maybe you could go for something simpler, like just outputting the name of the file thats copied ? You won't know how many files still need to be copied, but you than are able to see the progression.

    You could ofcourse also do a google for some yester-years commandline copying program which includes a progressbar. Like perhaps this one :

    https://www.bootablecd.de/downloads/dosprog/zcopy/zcopy35.zip

    Regards,
    Rudy Wieser
    Tried 4DOS a bit tonight and it still won't work unfortunately. I set it up by using shell=4dos.com in CONFIG.SYS but no joy. I also tried ZCOPY and it's not quite what I'm looking for - it's full screen and has the authors info at the top of the screen. If there are any other file copiers with progress bars please let me know. Thanks for the replies and help.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From R.Wieser@address@is.invalid to comp.os.msdos.misc on Sat Nov 18 08:44:41 2023
    From Newsgroup: comp.os.msdos.misc

    Dancer,

    I also tried ZCOPY and it's not quite what I'm looking for - it's full screen
    and has the authors info at the top of the screen. If there are any other file copiers with progress bars please let me know.

    I don't want to be rude, but have you already thought of doing some
    searching yourself ? I found that zcopy program in about 5 minutes by seaching for "DOS copy with progress bar" (on DDG).

    Regards,
    Rudy Wieser


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Herbert Kleebauer@klee@unibwm.de to comp.os.msdos.misc on Sat Nov 18 11:05:07 2023
    From Newsgroup: comp.os.msdos.misc

    On 18.11.2023 00:54, dancer79uk wrote:

    Tried 4DOS a bit tonight and it still won't work unfortunately.

    I don't understand your problem. The content of "%cdrom%\WIN98"
    will never change, so just make a "dir /b" of the files to a list
    file. Process this file on a WinNT+ PC with a cmd batch (only a few
    lines of code) to get a batch file like this:

    copy file1 c:\dest
    echo file 1 of 455 copied
    copy file2 c:\dest
    echo file 2 of 455 copied
    copy file3 c:\dest
    echo file 3 of 455 copied
    :
    :

    Then just put this batch on your Wi98 boot disk
    and execute it.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From dancer79uk@dancer79uk@gmail.com to comp.os.msdos.misc on Sat Nov 18 06:03:59 2023
    From Newsgroup: comp.os.msdos.misc

    On Saturday, 18 November 2023 at 10:04:47 UTC, Herbert Kleebauer wrote:
    On 18.11.2023 00:54, dancer79uk wrote:

    Tried 4DOS a bit tonight and it still won't work unfortunately.
    I don't understand your problem. The content of "%cdrom%\WIN98"
    will never change, so just make a "dir /b" of the files to a list
    file. Process this file on a WinNT+ PC with a cmd batch (only a few
    lines of code) to get a batch file like this:

    copy file1 c:\dest
    echo file 1 of 455 copied
    copy file2 c:\dest
    echo file 2 of 455 copied
    copy file3 c:\dest
    echo file 3 of 455 copied
    :
    :

    Then just put this batch on your Wi98 boot disk
    and execute it.
    I think what I'm going to do is put on screen how many files there are to copy and stick with 'Please Wait'. I've got 3.51 and NT4 so I may have a go at that.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From dancer79uk@dancer79uk@gmail.com to comp.os.msdos.misc on Sat Nov 18 06:12:19 2023
    From Newsgroup: comp.os.msdos.misc

    On Saturday, 18 November 2023 at 10:04:47 UTC, Herbert Kleebauer wrote:
    On 18.11.2023 00:54, dancer79uk wrote:

    Tried 4DOS a bit tonight and it still won't work unfortunately.
    I don't understand your problem. The content of "%cdrom%\WIN98"
    will never change, so just make a "dir /b" of the files to a list
    file. Process this file on a WinNT+ PC with a cmd batch (only a few
    lines of code) to get a batch file like this:

    copy file1 c:\dest
    echo file 1 of 455 copied
    copy file2 c:\dest
    echo file 2 of 455 copied
    copy file3 c:\dest
    echo file 3 of 455 copied
    :
    :

    Then just put this batch on your Wi98 boot disk
    and execute it.
    To R.Weiser - No, you're not being rude and yes I have done my research on this and ZCOPY was a program that came up. XXCOPY16 has progress bar that comes with the 16bit version that goes accross the top of the screen. And 'DOS program with copy bar' DOS freeware file copying program' were some of the strings I have used in a Google & StartPage search. Like I said in an earlier post, I like the look of the code as posted at the start as it would be what I'm looking for. As it's not COMMAND.COM compatible, I thought I'd see if there was an altenative to it. I may keep looking for something in future but for now, I think the previous posting might be the best bet - show how many files are to copy and then display 'Please wait...'
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Herbert Kleebauer@klee@unibwm.de to comp.os.msdos.misc on Sat Nov 18 16:35:50 2023
    From Newsgroup: comp.os.msdos.misc

    On 18.11.2023 15:12, dancer79uk wrote:


    Like I said in an earlier post, I like the look of the code
    as posted at the start as it would be what I'm looking for.
    As it's not COMMAND.COM compatible, I thought I'd see if
    there was an altenative to it.

    Search for win95cmd.exe. This is a program provided by
    Microsoft as a cmd.exe replacement (with some restrictions)
    for Win95/98. It could be downloaded from a ftp server
    at microsoft.com, but I don't know if it is still
    available there. Maybe you will find some other download
    site. If not and your email address is valid, I can send
    you a copy:

    02.02.2000 22:17 307.472 WIN95CMD.EXE


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From JJ@jj4public@outlook.com to comp.os.msdos.misc on Sun Nov 19 16:26:43 2023
    From Newsgroup: comp.os.msdos.misc

    On Sat, 18 Nov 2023 16:35:50 +0100, Herbert Kleebauer wrote:

    Search for win95cmd.exe. This is a program provided by
    Microsoft as a cmd.exe replacement (with some restrictions)
    for Win95/98. It could be downloaded from a ftp server
    at microsoft.com, but I don't know if it is still
    available there. Maybe you will find some other download
    site. If not and your email address is valid, I can send
    you a copy:

    02.02.2000 22:17 307.472 WIN95CMD.EXE

    CMD is a Windows program. It won't work under pure DOS.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From R.Wieser@address@is.invalid to comp.os.msdos.misc on Mon Nov 20 08:34:32 2023
    From Newsgroup: comp.os.msdos.misc

    dancer,

    To R.Weiser - No, you're not being rude and yes I have done my research
    ...

    Good. :-) It just happens too often that people "forget" to put some
    effort into it themselves.

    And by the way, I posted that link because I, just like you, where able to find something that /looked/ like it could be doing what you wanted - I
    never used it myself.

    Regards,
    Rudy Wieser.


    --- Synchronet 3.20a-Linux NewsLink 1.114