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.
On Sun, 12 Nov 2023 14:54:02 -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?
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?
might as well use only one tool which has all of the needed
capabilities, which is 4DOS.
JJ,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.
might as well use only one tool which has all of the neededThats 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. :-)
capabilities, which is 4DOS.
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 take it that CMD.EXE can't be used on a COMMAND.COM based boot disk?
I take it that CMD.EXE can't be used on a COMMAND.COM based boot disk?
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
dancer,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.
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 pecentageI know what you mean, waiting for something to finish without any indication that anything is going on is ... less than pleasant.
so that you how far the copying has done
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
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.
Tried 4DOS a bit tonight and it still won't work unfortunately.
On 18.11.2023 00:54, dancer79uk wrote: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.
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.
On 18.11.2023 00:54, dancer79uk wrote: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...'
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.
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
To R.Weiser - No, you're not being rude and yes I have done my research
...
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 997 |
Nodes: | 10 (0 / 10) |
Uptime: | 224:43:42 |
Calls: | 13,046 |
Calls today: | 1 |
Files: | 186,574 |
Messages: | 3,292,749 |