Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.comp.os.windows-10 > #183090 > unrolled thread

Re: what is the fastest command line copy?

Started byDual Boot Windows <invalid@invalid.invalid>
First post2025-03-31 02:12 +0100
Last post2025-04-01 02:01 -0700
Articles 20 on this page of 73 — 16 participants

Back to article view | Back to alt.comp.os.windows-10

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: what is the fastest command line copy? Dual Boot Windows <invalid@invalid.invalid> - 2025-03-31 02:12 +0100
    Re: what is the fastest command line copy? Steve Hayes <hayesstw@telkomsa.net> - 2025-03-31 04:43 +0200
      Re: what is the fastest command line copy? Paul <nospam@needed.invalid> - 2025-03-31 00:47 -0400
        Re: what is the fastest command line copy? Steve Hayes <hayesstw@telkomsa.net> - 2025-03-31 11:06 +0200
        Re: what is the fastest command line copy? Stan Brown <the_stan_brown@fastmail.fm> - 2025-03-31 12:10 -0700
        Re: what is the fastest command line copy? "Jonathan N. Little" <lws4art@gmail.com> - 2025-04-01 18:56 -0400
      Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-03-31 08:21 -0400
        Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-03-31 15:47 +0200
          Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-03-31 10:54 -0400
            Re: what is the fastest command line copy? Andy Burns <usenet@andyburns.uk> - 2025-03-31 15:59 +0100
            Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-03-31 17:32 +0200
            Re: what is the fastest command line copy? Steve Hayes <hayesstw@telkomsa.net> - 2025-04-01 07:00 +0200
              Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-04-01 09:11 +0200
              Re: what is the fastest command line copy? Paul <nospam@needed.invalid> - 2025-04-01 03:44 -0400
              Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-04-01 09:26 -0400
                Re: what is the fastest command line copy? Steve Hayes <hayesstw@telkomsa.net> - 2025-04-02 08:50 +0200
                  Re: what is the fastest command line copy? Paul <nospam@needed.invalid> - 2025-04-02 04:15 -0400
                    Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-04-02 10:35 +0200
                      Re: what is the fastest command line copy? Paul <nospam@needed.invalid> - 2025-04-02 05:54 -0400
                        Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-04-02 16:15 +0200
                          Re: what is the fastest command line copy? Paul <nospam@needed.invalid> - 2025-04-02 11:40 -0400
                            Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-04-02 18:13 +0200
                              Re: what is the fastest command line copy? Paul <nospam@needed.invalid> - 2025-04-02 12:41 -0400
                                Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-04-02 20:27 +0200
                                  Re: what is the fastest command line copy? Paul <nospam@needed.invalid> - 2025-04-03 03:22 -0400
                                    Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-04-03 13:10 +0200
                      Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-04-02 07:57 -0400
                        Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-04-02 16:19 +0200
                          Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-04-02 11:04 -0400
                            Re: what is the fastest command line copy? Paul <nospam@needed.invalid> - 2025-04-02 12:04 -0400
                            Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-04-02 18:06 +0200
                    Re: what is the fastest command line copy? Frank Slootweg <this@ddress.is.invalid> - 2025-04-02 12:41 +0000
                      Re: what is the fastest command line copy? Paul <nospam@needed.invalid> - 2025-04-02 12:15 -0400
                        Re: what is the fastest command line copy? Frank Slootweg <this@ddress.is.invalid> - 2025-04-02 17:36 +0000
                    Re: what is the fastest command line copy? Stan Brown <the_stan_brown@fastmail.fm> - 2025-04-02 10:50 -0700
                    Re: what is the fastest command line copy? Steve Hayes <hayesstw@telkomsa.net> - 2025-04-03 05:24 +0200
                      Re: what is the fastest command line copy? Democrat <Democrat@invalid.invalid> - 2025-04-03 06:00 +0000
                        Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-04-03 08:39 +0200
                        Re: what is the fastest command line copy? Steve Hayes <hayesstw@telkomsa.net> - 2025-04-03 15:55 +0200
                          Re: what is the fastest command line copy? Frank Slootweg <this@ddress.is.invalid> - 2025-04-03 15:06 +0000
                            Re: what is the fastest command line copy? Steve Hayes <hayesstw@telkomsa.net> - 2025-04-04 13:55 +0200
                              Re: what is the fastest command line copy? Frank Slootweg <this@ddress.is.invalid> - 2025-04-04 12:11 +0000
                                Re: what is the fastest command line copy? Don_from_AZ <djatechNOSPAM@comcast.net.invalid> - 2025-04-04 10:32 -0700
                                Re: what is the fastest command line copy? Steve Hayes <hayesstw@telkomsa.net> - 2025-04-05 05:20 +0200
                                  Re: what is the fastest command line copy? T <T@invalid.invalid> - 2025-04-05 00:44 -0700
                                  Re: what is the fastest command line copy? Daniel70 <daniel47@eternal-september.org> - 2025-04-06 20:20 +1000
                                    Re: what is the fastest command line copy? "Kerr-Mudd, John" <admin@127.0.0.1> - 2025-04-06 21:15 +0100
                              Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-04-04 08:49 -0400
                                Re: what is the fastest command line copy? Steve Hayes <hayesstw@telkomsa.net> - 2025-04-05 05:29 +0200
                                  Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-04-05 08:26 -0400
                                Re: what is the fastest command line copy? Paul <nospam@needed.invalid> - 2025-04-05 00:37 -0400
                                  Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-04-05 08:18 -0400
                          Re: what is the fastest command line copy? Char Jackson <none@none.invalid> - 2025-04-03 11:00 -0500
                  Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-04-02 07:53 -0400
                    Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-04-02 16:26 +0200
                      Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-04-02 11:03 -0400
                        Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-04-02 18:04 +0200
                        Re: what is the fastest command line copy? Paul <nospam@needed.invalid> - 2025-04-02 12:36 -0400
                          Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-04-02 13:07 -0400
                            Re: what is the fastest command line copy? Paul <nospam@needed.invalid> - 2025-04-03 04:14 -0400
                              Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-04-03 08:40 -0400
                  Re: what is the fastest command line copy? Stan Brown <the_stan_brown@fastmail.fm> - 2025-04-02 10:43 -0700
                    Re: what is the fastest command line copy? Char Jackson <none@none.invalid> - 2025-04-02 18:59 -0500
                  Re: what is the fastest command line copy? Stan Brown <the_stan_brown@fastmail.fm> - 2025-04-02 11:11 -0700
          Re: what is the fastest command line copy? knuttle <keith_nuttle@yahoo.com> - 2025-03-31 10:59 -0400
            Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-03-31 17:26 +0200
              Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-03-31 13:05 -0400
                Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-03-31 20:18 +0200
                  Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-03-31 14:43 -0400
      Re: what is the fastest command line copy? Stan Brown <the_stan_brown@fastmail.fm> - 2025-03-31 13:40 -0700
    Re: what is the fastest command line copy? T <T@invalid.invalid> - 2025-03-30 23:03 -0700
    Re: what is the fastest command line copy? T <T@invalid.invalid> - 2025-03-30 23:43 -0700
    Re: what is the fastest command line copy? T <T@invalid.invalid> - 2025-04-01 02:01 -0700

Page 2 of 4 — ← Prev page 1 [2] 3 4  Next page →


#183177

FromPaul <nospam@needed.invalid>
Date2025-04-02 11:40 -0400
Message-ID<vsjlp1$26ef0$1@dont-email.me>
In reply to#183172
On Wed, 4/2/2025 10:15 AM, R.Wieser wrote:
> Paul,
> 
>> That return() is on main().
> 
> Yes, and ?
> 
> Regards,
> Rudy Wieser
> 
> 

It's the same as exit().

Execution does not continue past that point.

   Paul

[toc] | [prev] | [next] | [standalone]


#183181

From"R.Wieser" <address@is.invalid>
Date2025-04-02 18:13 +0200
Message-ID<vsjnoa$28jln$3@dont-email.me>
In reply to#183177
Paul,

>>> That return() is on main().
>>
>> Yes, and ?
>
> It's the same as exit().
>
> Execution does not continue past that point.

Your example doesn't show a "return()" of any kind. Nor a "main()" for that 
matter...

Bad examples are bad. :-(

Regards,
Rudy Wieser

[toc] | [prev] | [next] | [standalone]


#183185

FromPaul <nospam@needed.invalid>
Date2025-04-02 12:41 -0400
Message-ID<vsjpb2$2ac7u$1@dont-email.me>
In reply to#183181
On Wed, 4/2/2025 12:13 PM, R.Wieser wrote:
> Paul,
> 
>>>> That return() is on main().
>>>
>>> Yes, and ?
>>
>> It's the same as exit().
>>
>> Execution does not continue past that point.
> 
> Your example doesn't show a "return()" of any kind. Nor a "main()" for that 
> matter...
> 
> Bad examples are bad. :-(
> 
> Regards,
> Rudy Wieser
> 
> 

Um, that was a code snippet.

It is showing the CoPilot choice of an error handling pattern.

If that was a subroutine or function call, the caller could
do the analysis of the return value.

   Paul

[toc] | [prev] | [next] | [standalone]


#183192

From"R.Wieser" <address@is.invalid>
Date2025-04-02 20:27 +0200
Message-ID<vsjvjj$2gj8d$1@dont-email.me>
In reply to#183185
Paul,

[quote]
> In scripting, you have to be careful with "volatile" items
> like an %errorlevel% . They must be copied before they
> are lost,
 ...
> D:\>paulcopy64 a b
> Error opening source file: No such file or directory
>
> D:\>dir
> Volume in drive D
>
> Directory of D:\
> Tue, 03/18/2025  09:56 AM           252,122 paulcopy64.exe
>
> D:\>echo %errorlevel%
> 0                              # Oops! I lost my copy failure code.

On the other hand, you should not contuinue (after the failed copy) when
you are getting an error ...
[/quote]

> Um, that was a code snippet.

I seem to be missing something..  Could you point out your "code snippet" in
the above ?

Yes, thats quoted from my reply to you talking about %errorlevel% losing its
failure code.

Regards,
Rudy Wieser


[toc] | [prev] | [next] | [standalone]


#183208

FromPaul <nospam@needed.invalid>
Date2025-04-03 03:22 -0400
Message-ID<vslcv8$32d9$1@dont-email.me>
In reply to#183192
On Wed, 4/2/2025 2:27 PM, R.Wieser wrote:
> Paul,
> 
> [quote]
>> In scripting, you have to be careful with "volatile" items
>> like an %errorlevel% . They must be copied before they
>> are lost,
>  ...
>> D:\>paulcopy64 a b
>> Error opening source file: No such file or directory
>>
>> D:\>dir
>> Volume in drive D
>>
>> Directory of D:\
>> Tue, 03/18/2025  09:56 AM           252,122 paulcopy64.exe
>>
>> D:\>echo %errorlevel%
>> 0                              # Oops! I lost my copy failure code.
> 
> On the other hand, you should not contuinue (after the failed copy) when
> you are getting an error ...
> [/quote]
> 
>> Um, that was a code snippet.
> 
> I seem to be missing something..  Could you point out your "code snippet" in
> the above ?
> 
> Yes, thats quoted from my reply to you talking about %errorlevel% losing its
> failure code.
> 
> Regards,
> Rudy Wieser
> 

So as it turns out, it's more complicated than I thought. There is ERRORLEVEL
and %errorlevel% does not actually exist. But there is a potential fallback
behavior for creating it anyway.

https://devblogs.microsoft.com/oldnewthing/20080926-00/?p=20743

   "Now, it does happen to be the case that if command extensions are enabled and you say %ERRORLEVEL%,
    then the command processor first looks for an environment variable called ERRORLEVEL, and if it
    can’t find one, then it replaces %ERRORLEVEL% with the current value of the internal error level value.
    It’s a fallback step, in the same way that your neighbor is a fallback delivery location if you aren’t home.
    If you file a change-of-address form for yourself, that doesn’t affect packages sent to your neighbor. "

*******

D:\>paulcopy64 a b
Error opening source file: No such file or directory

D:\>if ERRORLEVEL 1 echo Does this print?
Does this print?

D:\>paulcopy64 a b
Error opening source file: No such file or directory

D:\>if ERRORLEVEL 0 echo Does this print?
Does this print?

So something is wrong here.

D:\>paulcopy64 a b
Error opening source file: No such file or directory

D:\>echo %errorlevel%
1

If I create an "a" file, we can try again. This is to check
that the value is actually coming from the program.

D:\>paulcopy64 a b
file_size = 0
Prepare buffer...
Starting run...
some_size read  = 0
Read  0 bytes in 000.001292 seconds
some_size write = 0
Wrote 0 bytes in 000.001744 seconds
File copied successfully.


D:\>echo %errorlevel%
0

I guess the only way to prove something works then, is to
write a script and expect different behavior inside ??? I don't
have the key mentioned here, there is no HKCU Command Processor in W11.

   HKCU\Software\Microsoft\Command Processor
       EnableExtensions DWORD 1               # enabled

   cmd /y disables command extensions for this cmd session
   cmd /x enables command extensions for this cmd session

It turns out the key does already exist, but it is at this
location, making it machine wide and it is enabled.

   HKLM\Software\Microsoft\Command Processor
       EnableExtensions DWORD 1               # enabled

Now I can run my script

@;echo off
paulcopy64 a b
if ERRORLEVEL 1 echo The result is 1 and this is bad

With the "a" file missing, it prints

D:\>myscript.bat
Error opening source file: No such file or directory
The result is 1 and this is bad

With the "a" file present, it does not print, at the script level,
so ERRORLEVEL is something other than 1.

D:\>myscript.bat
file_size = 0
Prepare buffer...
Starting run...
some_size read  = 0
Read  0 bytes in 000.001170 seconds
some_size write = 0
Wrote 0 bytes in 000.001974 seconds
File copied successfully.

If I change the script to

@;echo off
paulcopy64 a b
echo %errorlevel%

the value is falling through as Raymond explained.

D:\>myscript.bat
Error opening source file: No such file or directory
1

If I change the script to

@;echo off
paulcopy64 a b
if "%errorlevel%"=="1" echo The result is 1

and run with no "a" file

D:\>myscript.bat
Error opening source file: No such file or directory
The result is 1

Exciting. Let's see what this does.

@;echo off
set globalvar=The value is
paulcopy64 a b
set globalvar=%globalvar% %errorlevel%
REM The dot removes the leading space character
echo.%globalvar%
echo This is a test

gives an output of

D:\>myscript.bat
Error opening source file: No such file or directory
The value is 1
This is a test

And this is why I don't write batchscript. It's
about as much fun as writing in assembler.

Ref: Would not have got this far, without a web page.
     It's still like pulling teeth.
https://www.tutorialspoint.com/batch_script/batch_script_quick_guide.htm

   Paul

[toc] | [prev] | [next] | [standalone]


#183213

From"R.Wieser" <address@is.invalid>
Date2025-04-03 13:10 +0200
Message-ID<vslqbo$gpj3$1@dont-email.me>
In reply to#183208
Paul,

>> I seem to be missing something..  Could you point out your "code snippet"
>> in
>> the above ?
>>
>> Yes, thats quoted from my reply to you talking about %errorlevel% losing
>> its
>> failure code.
>>
>> Regards,
>> Rudy Wieser
>>
>
> So as it turns out, it's more complicated than I thought. There is
> ERRORLEVEL
> and %errorlevel% does not actually exist.

Nice to see that you again refuse to reply when I point out something
obvious.  You mostly read like you are quite knowledgabe, but you lose 
points for that behaiviour.

Also, why did you quote my whole(!) post if you where not intending to
address any of it ?

Regards,
Rudy Wieser


[toc] | [prev] | [next] | [standalone]


#183169

FromNewyana2 <newyana@invalid.nospam>
Date2025-04-02 07:57 -0400
Message-ID<vsj8lo$1ot1m$2@dont-email.me>
In reply to#183161
On 4/2/2025 4:35 AM, R.Wieser wrote:

> On the other hand, you should not contuinue (after the failed copy) when you
> are getting an error ...
> 

  >> /usr/bin/x86_64-w64-mingw32-gcc -D_FILE_OFFSET_BITS=64 
-I/usr/x86_64-w64-mingw32/include -o paulcopy64.exe paulcopy64.c

Anyone who can cook up a command line like that...
You don't ask questions. :)

[toc] | [prev] | [next] | [standalone]


#183173

From"R.Wieser" <address@is.invalid>
Date2025-04-02 16:19 +0200
Message-ID<vsjhfo$222l7$2@dont-email.me>
In reply to#183169
Newyana2,

>  >> 
> /usr/bin/x86_64-w64-mingw32-gcc -D_FILE_OFFSET_BITS=64 -I/usr/x86_64-w64-mingw32/include 
>  -o paulcopy64.exe paulcopy64.c
>
> Anyone who can cook up a command line like that...
> You don't ask questions. :)

You mean something like :

%BD%\tasm32b /d?BaseName=%1 /d??Resource="%RD%" /t /kh10000 /l /m2 
/i%HD%\Inc /i%HD%\Dll /i%HD%\DBG %1

Been there, done that - and put it into a batchfile. :-)

Regards,
Rudy Wieser

[toc] | [prev] | [next] | [standalone]


#183176

FromNewyana2 <newyana@invalid.nospam>
Date2025-04-02 11:04 -0400
Message-ID<vsjjjq$2446b$2@dont-email.me>
In reply to#183173
On 4/2/2025 10:19 AM, R.Wieser wrote:

> %BD%\tasm32b /d?BaseName=%1 /d??Resource="%RD%" /t /kh10000 /l /m2
> /i%HD%\Inc /i%HD%\Dll /i%HD%\DBG %1
> 

Oh, boy. It looks like I'll have to call in some Perl nuts for backup.

[toc] | [prev] | [next] | [standalone]


#183178

FromPaul <nospam@needed.invalid>
Date2025-04-02 12:04 -0400
Message-ID<vsjn6p$281vc$1@dont-email.me>
In reply to#183176
On Wed, 4/2/2025 11:04 AM, Newyana2 wrote:
> On 4/2/2025 10:19 AM, R.Wieser wrote:
> 
>> %BD%\tasm32b /d?BaseName=%1 /d??Resource="%RD%" /t /kh10000 /l /m2
>> /i%HD%\Inc /i%HD%\Dll /i%HD%\DBG %1
>>
> 
> Oh, boy. It looks like I'll have to call in some Perl nuts for backup.
> 

With the command I cooked up, there are only so many options, and
it is the process of deduction. I think only about eight possibilities,
and some don't count and so on :-)

I think you would find my set of lines to compile directly with
the Visual Studio compiler without opening Visual Studio at all,
more interesting. That one took all morning to cook up. The Linux
one is more thinking than typing, the VS one is more typing
than thinking. You have to install SDKs in a modern Visual Studio
Community Edition, to even work with C/C++ source, and the SDKs
have to be included in some of the path(s).

The scary part, is tools like gcc or g++, have an infinite number
of parameters, and there are people who actually understand
all of it. That's well past my pay scale.

   Paul

[toc] | [prev] | [next] | [standalone]


#183180

From"R.Wieser" <address@is.invalid>
Date2025-04-02 18:06 +0200
Message-ID<vsjno9$28jln$2@dont-email.me>
In reply to#183176
Newyana2

>> %BD%\tasm32b /d?BaseName=%1 /d??Resource="%RD%" /t /kh10000 /l /m2
>> /i%HD%\Inc /i%HD%\Dll /i%HD%\DBG %1
>>
>
> Oh, boy. It looks like I'll have to call in some Perl nuts for backup.

Don't make me post the whole batchfile ! :-)

Regards,
Rudy Wieser

[toc] | [prev] | [next] | [standalone]


#183171

FromFrank Slootweg <this@ddress.is.invalid>
Date2025-04-02 12:41 +0000
Message-ID<vsjiap.e54.1@ID-201911.user.individual.net>
In reply to#183158
Paul <nospam@needed.invalid> wrote:
> On Wed, 4/2/2025 2:50 AM, Steve Hayes wrote:
> > On Tue, 1 Apr 2025 09:26:02 -0400, Newyana2 <newyana@invalid.nospam>
> > wrote:
> > 
> >> On 4/1/2025 1:00 AM, Steve Hayes wrote:
> >>
> >>> I've hitherto uased batch files, which are a form of scripting.
> >>>
> >>> Is there a better tool to use for this?
> >>
> >>     Big topic. I guess a lot of it depends on what you're used to.
> >> For people who started with DOS, commandline feels natural.
> >> And it can do some complex things. I try to avoid it because
> >> it's relatively limited and combines coding with doing, by which
> >> I mean, every time I want to do something I have to remember
> >> or look up the exact syntax I'll need. So I have to write the code
> >> every time, so to speak. The whole point of scripting for me is
> >> so that I only have to do something once. Next time I only have
> >> to double-click or drag-drop.
> > 
> > I'm not sure what you're saying here. 
> > 
> > I have four batch files:
> > 
> > dsk2flsh.bat
> > flsh2lap.bat
> > lap2flsh.bat
> > flsh2dsk.bat
> > 
> > I only have to remember the exact syntax when I make the batch files,
> > and after that I I have to remember is the name of the batch file. 
> 
> When those .bat files copy things, do you check
> the "error number" to see if the copy
> was successful ?

  Note that (this part of) the discussion is for .bat files which mainly
contain a single 'complicated' command, so the user does not have to
remember the complicated command, but just the name of hir .bat file.

  For *such* a .bat file, if the command fails, it will give the same
error(s) as if the command was typed manually, so there's no need for
checking the error number.

> Scripting is "programming", and the same things I would
> have to check when writing a C language program, those
> are still issues when running a (so-called OS) copy program.

  Yes, scripting - i.e. also .bat files - is "programming", but for
simple .bat files, such are under discussion here, there's no need to
make things more complicated than just putting the 'complicated' command
in a .bat file.

[...]

[toc] | [prev] | [next] | [standalone]


#183182

FromPaul <nospam@needed.invalid>
Date2025-04-02 12:15 -0400
Message-ID<vsjnrh$28nan$1@dont-email.me>
In reply to#183171
On Wed, 4/2/2025 8:41 AM, Frank Slootweg wrote:
> Paul <nospam@needed.invalid> wrote:
>> On Wed, 4/2/2025 2:50 AM, Steve Hayes wrote:
>>> On Tue, 1 Apr 2025 09:26:02 -0400, Newyana2 <newyana@invalid.nospam>
>>> wrote:
>>>
>>>> On 4/1/2025 1:00 AM, Steve Hayes wrote:
>>>>
>>>>> I've hitherto uased batch files, which are a form of scripting.
>>>>>
>>>>> Is there a better tool to use for this?
>>>>
>>>>     Big topic. I guess a lot of it depends on what you're used to.
>>>> For people who started with DOS, commandline feels natural.
>>>> And it can do some complex things. I try to avoid it because
>>>> it's relatively limited and combines coding with doing, by which
>>>> I mean, every time I want to do something I have to remember
>>>> or look up the exact syntax I'll need. So I have to write the code
>>>> every time, so to speak. The whole point of scripting for me is
>>>> so that I only have to do something once. Next time I only have
>>>> to double-click or drag-drop.
>>>
>>> I'm not sure what you're saying here. 
>>>
>>> I have four batch files:
>>>
>>> dsk2flsh.bat
>>> flsh2lap.bat
>>> lap2flsh.bat
>>> flsh2dsk.bat
>>>
>>> I only have to remember the exact syntax when I make the batch files,
>>> and after that I I have to remember is the name of the batch file. 
>>
>> When those .bat files copy things, do you check
>> the "error number" to see if the copy
>> was successful ?
> 
>   Note that (this part of) the discussion is for .bat files which mainly
> contain a single 'complicated' command, so the user does not have to
> remember the complicated command, but just the name of hir .bat file.
> 
>   For *such* a .bat file, if the command fails, it will give the same
> error(s) as if the command was typed manually, so there's no need for
> checking the error number.
> 
>> Scripting is "programming", and the same things I would
>> have to check when writing a C language program, those
>> are still issues when running a (so-called OS) copy program.
> 
>   Yes, scripting - i.e. also .bat files - is "programming", but for
> simple .bat files, such are under discussion here, there's no need to
> make things more complicated than just putting the 'complicated' command
> in a .bat file.
> 
> [...]
> 

Well, someone is expressing an interest in scripting, and I don't
want them picking up any bad habits.

I use a different approach than Steve, for one-liners. I have
a separate notes file in the backup area, and all the one-liners
are copy/pasted in there. Copy a line from that file, into a
separate Notepad, edit the details as required, then paste it raw
into the Terminal window, and then all the side effects are visible
on the screen.

It's like code inspection, doing it that way. Anything moving data
around, deserves extra eyeballs.

   Paul

[toc] | [prev] | [next] | [standalone]


#183188

FromFrank Slootweg <this@ddress.is.invalid>
Date2025-04-02 17:36 +0000
Message-ID<vsk3js.14fo.1@ID-201911.user.individual.net>
In reply to#183182
Paul <nospam@needed.invalid> wrote:
> On Wed, 4/2/2025 8:41 AM, Frank Slootweg wrote:
> > Paul <nospam@needed.invalid> wrote:
> >> On Wed, 4/2/2025 2:50 AM, Steve Hayes wrote:
[...]
> >>> I'm not sure what you're saying here. 
> >>>
> >>> I have four batch files:
> >>>
> >>> dsk2flsh.bat
> >>> flsh2lap.bat
> >>> lap2flsh.bat
> >>> flsh2dsk.bat
> >>>
> >>> I only have to remember the exact syntax when I make the batch files,
> >>> and after that I I have to remember is the name of the batch file. 
> >>
> >> When those .bat files copy things, do you check
> >> the "error number" to see if the copy
> >> was successful ?
> > 
> >   Note that (this part of) the discussion is for .bat files which mainly
> > contain a single 'complicated' command, so the user does not have to
> > remember the complicated command, but just the name of hir .bat file.
> > 
> >   For *such* a .bat file, if the command fails, it will give the same
> > error(s) as if the command was typed manually, so there's no need for
> > checking the error number.
> > 
> >> Scripting is "programming", and the same things I would
> >> have to check when writing a C language program, those
> >> are still issues when running a (so-called OS) copy program.
> > 
> >   Yes, scripting - i.e. also .bat files - is "programming", but for
> > simple .bat files, such are under discussion here, there's no need to
> > make things more complicated than just putting the 'complicated' command
> > in a .bat file.
> > 
> > [...]
> > 
> 
> Well, someone is expressing an interest in scripting, and I don't
> want them picking up any bad habits.

  Fair enough. Just as long we agree that there's nothing wrong with
Steve's method.

> I use a different approach than Steve, for one-liners. I have
> a separate notes file in the backup area, and all the one-liners
> are copy/pasted in there. Copy a line from that file, into a
> separate Notepad, edit the details as required, then paste it raw
> into the Terminal window, and then all the side effects are visible
> on the screen.

  Again, fair enough, different strokes for different folks.

  FWIW, if the task and parameters are static, I use a .bat file instead
of copy and paste.

  And my 'one-liners' are two or more lines, because they start with
'@echo off'! :-)

> It's like code inspection, doing it that way. Anything moving data
> around, deserves extra eyeballs.

  "code inspection"!? *I* wrote it, so it's purrfect!

[toc] | [prev] | [next] | [standalone]


#183190

FromStan Brown <the_stan_brown@fastmail.fm>
Date2025-04-02 10:50 -0700
Message-ID<MPG.425718c6235f3eea9903da@news.individual.net>
In reply to#183158
On Wed, 2 Apr 2025 04:15:57 -0400, Paul wrote: 
> 
> When those .bat files copy things, do you check
> the "error number" to see if the copy
> was successful ?
> 
> Scripting is "programming", and the same things I would
> have to check when writing a C language program, those
> are still issues when running a (so-called OS) copy program.
> 
> Here, my personal copy program returns a value of "1", if the source file
> cannot be opened. This clause was written by an AI by the way.
> "It doesn't have to make sense", as the AI would tell you :-)
> What the AI didn't tell me, is there is a bug in one of the
> library routines I should know about.

What is the bug, Paul? Or were you just referrng to your initial 
version losing %ERRORLEVEL% because you didn't save it before running 
a DIR command?

>     # part of paulcopy64.exe source code... Mostly written by an AI.
>     # I only fix them up and make them work. The comment is written by the AI.
> 
>     // Open the source file in binary mode
>     FILE *source = fopen64(argv[1], "rb");
>     if (!source) {
>         perror("Error opening source file");
>         return 1;
>     }
> 
> Now, we test in a Command Prompt, and see if the returned integer
> error code, is arriving OK or not. It is. If each error has a
> different integer number, you can tell the error types apart,
> with numeric checks of %errorlevel% .
> 
> D:\>paulcopy64 a b
> Error opening source file: No such file or directory
> 
> D:\>echo %errorlevel%
> 1                               # Om my! My copy did not proceed.
> 
> Making a batch file is not "just making a laundry list".
> It needs conditional checks (somehow) of each
> stage of the operation.  And in my C program snippet, you can see
> the AI is doing the same thing. The AI assumes I will be scripting
> calls to "paulcopy64.exe" and scripting needs the number, to check
> the program run went OK.
> 
> In scripting, you have to be careful with "volatile" items
> like an %errorlevel% . They must be copied before they are lost,
> by the next utility program loading its success or failure status
> into that single variable in the shell.
> 
> Look at the following and note my handling mistake. The error result
> from the "dir" command, has overwritten the "1" left in the %errorlevel% .
> There was no error in the "dir" run and the result from it is "0".
> 
> D:\>paulcopy64 a b
> Error opening source file: No such file or directory
> 
> D:\>dir
>  Volume in drive D
> 
>  Directory of D:\
> Tue, 03/18/2025  09:56 AM           252,122 paulcopy64.exe
> 
> D:\>echo %errorlevel%
> 0                              # Oops! I lost my copy failure code.
> 
> The paulcopy64.exe was actually compiled on Ubuntu 23.04
> as a cross compile, as I have not managed to get a good
> mingw64 for Windows set up here. So I just cross-compiled
> it, and that is why the program is 252,122 bytes, when it
> should be a lot smaller for a dumb copy program.
> 
> # Asking Ubuntu to make a 64-bit version of a Windows EXE (a PE32+ EXE file).
> # The FILE_OFFSET_BITS is to enable 64 bit long length fields and stuff.
> # The compiler package (effectively a script) must be installed for the executable
> # of the compiler, to be found.  "x86_64-w64-mingw32-gcc" does not exist by default.
> # This allows my program to have "gobs" of RAM, compiling it this way :-)
> 
> /usr/bin/x86_64-w64-mingw32-gcc -D_FILE_OFFSET_BITS=64 -I/usr/x86_64-w64-mingw32/include -o paulcopy64.exe paulcopy64.c
> 
>    Paul



-- 
Stan Brown, Tehachapi, California, USA         https://BrownMath.com/
Shikata ga nai...

[toc] | [prev] | [next] | [standalone]


#183202

FromSteve Hayes <hayesstw@telkomsa.net>
Date2025-04-03 05:24 +0200
Message-ID<6fvrujdd5evb12c8rlegr0828lul68miiu@4ax.com>
In reply to#183158
On Wed, 2 Apr 2025 04:15:57 -0400, Paul <nospam@needed.invalid> wrote:

>On Wed, 4/2/2025 2:50 AM, Steve Hayes wrote:
>> I have four batch files:
>> 
>> dsk2flsh.bat
>> flsh2lap.bat
>> lap2flsh.bat
>> flsh2dsk.bat
>> 
>> I only have to remember the exact syntax when I make the batch files,
>> and after that I I have to remember is the name of the batch file. 
>> 
>> 
>
>When those .bat files copy things, do you check
>the "error number" to see if the copy
>was successful ?
>
>Scripting is "programming", and the same things I would
>have to check when writing a C language program, those
>are still issues when running a (so-called OS) copy program.
>
>Here, my personal copy program returns a value of "1", if the source file
>cannot be opened. This clause was written by an AI by the way.
>"It doesn't have to make sense", as the AI would tell you :-)
>What the AI didn't tell me, is there is a bug in one of the
>library routines I should know about.

My problems have been with the target file.

Sometimes, after the batch file has called the copy program (xxcopy in
the case of the desktop computer, Robocopy in the case of the laptop),
the file copied from the flash drive to the computer will not open. 

When that has happened, I have recopied the file using Norton
Commander, and then it has opened. 

-- 
Steve Hayes from Tshwane, South Africa
Web:  http://www.khanya.org.za/stevesig.htm
Blog: http://khanya.wordpress.com
E-mail - see web page, or parse: shayes at dunelm full stop org full stop uk

[toc] | [prev] | [next] | [standalone]


#183203

FromDemocrat <Democrat@invalid.invalid>
Date2025-04-03 06:00 +0000
Message-ID<vsl6vd$27uni$1@paganini.bofh.team>
In reply to#183202
On 03/04/2025 04:24, Steve Hayes wrote:

> 
> My problems have been with the target file.
> 
> Sometimes, after the batch file has called the copy program (xxcopy in
> the case of the desktop computer, Robocopy in the case of the laptop),
> the file copied from the flash drive to the computer will not open.
> 
> When that has happened, I have recopied the file using Norton
> Commander, and then it has opened.
> 

You need to post the content of your batch file(s). Don't expect people 
here to have ESP to read your mind. We are in 2025 and witchcraft, magic 
and religion is never practised unless you are a politician.

Have you noticed that politicians are always afraid to attack church 
leaders even if there is ample evidence that they are wrong and simple 
brain washing the masses!

How is Elon Musk? I hear he has decided to quit Trump administration 
because the price is too high to pay for helping him destroy democracy. 
Even Nazis think democracy is a good thing!

<https://youtu.be/Ahv3IKzMdHA?si=6b9H75b8PkeoRuMR>

South Africa got hammered by Trump's tariffs.

[toc] | [prev] | [next] | [standalone]


#183206

From"R.Wieser" <address@is.invalid>
Date2025-04-03 08:39 +0200
Message-ID<vslaep$fec$1@dont-email.me>
In reply to#183203
Democrat,

>> Sometimes ... the file copied from the flash drive to the
>> computer will not open.
...
> You need to post the content of your batch file(s).  Don't
> expect people here to have ESP to read your mind.

Why ?  Do you have any knowledge to how a batchfile will possibly interfere 
with the copying process - or even damage the copied file all by itself ?

Don't expect people here to have ESP to read your mind. If you have 
knowledge like that you really need to include it in your post.


Also, why only asking for the batchfile(s) and not (the sourcecode of) both 
coping programs well as the OS('es) involved and the hardware schematics of 
both machines and the flash drive too ?

Yeah, there are a *lot* of places where it could go wrong.  Including 
PEBKAC.

Heck, we do not even know what the damage to the copied file is.  It would 
be telling if its always the tail of the file thats missing ...


Also, leave your political views at the door.  This newsgroup is for Win10. 
If you want to fight about political views - or being told how right you 
are - than there are several newsgroups for just that purpose.

Regards,
Rudy Wieser

[toc] | [prev] | [next] | [standalone]


#183226

FromSteve Hayes <hayesstw@telkomsa.net>
Date2025-04-03 15:55 +0200
Message-ID<ij4tujt0bi35836r1abgrsfmnjbus67gu3@4ax.com>
In reply to#183203
On Thu, 3 Apr 2025 06:00:19 +0000, Democrat <Democrat@invalid.invalid>
wrote:

>On 03/04/2025 04:24, Steve Hayes wrote:
>
>> 
>> My problems have been with the target file.
>> 
>> Sometimes, after the batch file has called the copy program (xxcopy in
>> the case of the desktop computer, Robocopy in the case of the laptop),
>> the file copied from the flash drive to the computer will not open.
>> 
>> When that has happened, I have recopied the file using Norton
>> Commander, and then it has opened.
>> 
>
>You need to post the content of your batch file(s). Don't expect people 
>here to have ESP to read your mind. We are in 2025 and witchcraft, magic 
>and religion is never practised unless you are a politician.

I wasn't asking anyone to debug my batch files. I got into this
discussion by pointing out that I doing have to type our a series of
commands in the command line, I put them into a batch file, and
therefore a batch file is a kind of script. 

The error I referred to appears to be in one of the utes* called by
the batch file. 

* if applications can be called "apps" surely utilities can be called
"utes"?



 
-- 
Steve Hayes from Tshwane, South Africa
Web:  http://www.khanya.org.za/stevesig.htm
Blog: http://khanya.wordpress.com
E-mail - see web page, or parse: shayes at dunelm full stop org full stop uk

[toc] | [prev] | [next] | [standalone]


#183227

FromFrank Slootweg <this@ddress.is.invalid>
Date2025-04-03 15:06 +0000
Message-ID<vsmf6h.1l8.1@ID-201911.user.individual.net>
In reply to#183226
Steve Hayes <hayesstw@telkomsa.net> wrote:
[...]

> * if applications can be called "apps" surely utilities can be called
> "utes"?

  Utes are big things and apps are normally small things. But you can
call anything, anything you like, so 'utes' it is! :-)

<https://www.google.com/search?q=define%3A+ute>

[toc] | [prev] | [next] | [standalone]


Page 2 of 4 — ← Prev page 1 [2] 3 4  Next page →

Back to top | Article view | alt.comp.os.windows-10


csiph-web