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


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

{rightclick} New | Text Document

Started byWolf Greenblatt <wolf@greenblatt.net>
First post2024-10-15 08:47 -0400
Last post2024-11-25 18:04 -0500
Articles 10 on this page of 30 — 7 participants

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


Contents

  {rightclick} New | Text Document Wolf Greenblatt <wolf@greenblatt.net> - 2024-10-15 08:47 -0400
    Re: {rightclick} New | Text Document Big Al <alan@invalid.com> - 2024-10-15 09:53 -0400
    Re: {rightclick} New | Text Document Herbert Kleebauer <klee@unibwm.de> - 2024-10-15 16:43 +0200
      Re: {rightclick} New | Text Document Wolf Greenblatt <wolf@greenblatt.net> - 2024-10-15 13:04 -0400
        Re: {rightclick} New | Text Document Herbert Kleebauer <klee@unibwm.de> - 2024-10-16 00:44 +0200
          Re: {rightclick} New | Text Document Herbert Kleebauer <klee@unibwm.de> - 2024-10-16 01:49 +0200
            Re: {rightclick} New | Text Document Wolf Greenblatt <wolf@greenblatt.net> - 2024-10-15 23:12 -0400
              Re: {rightclick} New | Text Document Herbert Kleebauer <klee@unibwm.de> - 2024-10-16 09:44 +0200
                Re: {rightclick} New | Text Document Wolf Greenblatt <wolf@greenblatt.net> - 2024-10-16 16:31 -0400
              Re: {rightclick} New | Text Document Newyana2 <newyana@invalid.nospam> - 2024-10-16 08:52 -0400
    Re: {rightclick} New | Text Document Newyana2 <newyana@invalid.nospam> - 2024-10-15 11:26 -0400
    Re: {rightclick} New | Text Document Paul <nospam@needed.invalid> - 2024-10-15 13:38 -0400
    Re: {rightclick} New | Text Document Wolf Greenblatt <wolf@greenblatt.net> - 2024-11-07 22:42 -0500
      Re: {rightclick} New | Text Document "R.Wieser" <address@is.invalid> - 2024-11-08 09:07 +0100
        Re: {rightclick} New | Text Document Wolf Greenblatt <wolf@greenblatt.net> - 2024-11-08 09:14 -0500
          Re: {rightclick} New | Text Document "R.Wieser" <address@is.invalid> - 2024-11-08 17:18 +0100
            Re: {rightclick} New | Text Document Wolf Greenblatt <wolf@greenblatt.net> - 2024-11-08 13:58 -0500
              Re: {rightclick} New | Text Document "R.Wieser" <address@is.invalid> - 2024-11-08 22:18 +0100
                Re: {rightclick} New | Text Document Wolf Greenblatt <wolf@greenblatt.net> - 2024-11-08 20:24 -0500
                  Re: {rightclick} New | Text Document "R.Wieser" <address@is.invalid> - 2024-11-09 10:22 +0100
          Re: {rightclick} New | Text Document "R.Wieser" <address@is.invalid> - 2024-11-08 17:30 +0100
          Re: {rightclick} New | Text Document Herbert Kleebauer <klee@unibwm.de> - 2024-11-08 21:53 +0100
            Re: {rightclick} New | Text Document Wolf Greenblatt <wolf@greenblatt.net> - 2024-11-08 23:14 -0500
              Re: {rightclick} New | Text Document Zaidy036 <Zaidy036@air.isp.spam> - 2024-11-09 10:20 -0500
                Re: {rightclick} New | Text Document Wolf Greenblatt <wolf@greenblatt.net> - 2024-11-25 17:50 -0500
              Re: {rightclick} New | Text Document Herbert Kleebauer <klee@unibwm.de> - 2024-11-09 16:35 +0100
              Re: {rightclick} New | Text Document Herbert Kleebauer <klee@unibwm.de> - 2024-11-09 16:36 +0100
              Re: {rightclick} New | Text Document Herbert Kleebauer <klee@unibwm.de> - 2024-11-09 16:37 +0100
              Re: {rightclick} New | Text Document Herbert Kleebauer <klee@unibwm.de> - 2024-11-09 16:38 +0100
              Re: {rightclick} New | Text Document Wolf Greenblatt <wolf@greenblatt.net> - 2024-11-25 18:04 -0500

Page 2 of 2 — ← Prev page 1 [2]


#179786

From"R.Wieser" <address@is.invalid>
Date2024-11-08 17:30 +0100
Message-ID<vgleb5$3993f$1@dont-email.me>
In reply to#179784
Wolf,

>> The article cited explains why it's sophomoric to modify the PATH
>> variable.
>
> You mean this : "Getting more technical, modifying the system path is
> not exactly best practice since it may slow down the system, break other
> applications and even create security holes." ?   Thats mostly FUD.
>
> If you don't know what you're doing* than /almost everything/ is a
> security risk.

I forgot to mention: Using the "app path" method suffers the same security 
risk as what I quoted in the above quote.  If you "app path" a program and I 
drop a program of the same name in any folder on the PATH than my program, 
instead of yours, will run.

IOW, They have "spotted a problem" and just stopped thinking.

At least, I hope that that is what happened, and not yet another ... person 
who enjoys maliciously trolling others.

Regards,
Rudy Wieser

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


#179789

FromHerbert Kleebauer <klee@unibwm.de>
Date2024-11-08 21:53 +0100
Message-ID<vgltr1$3brmr$1@dont-email.me>
In reply to#179784
On 08.11.2024 15:14, Wolf Greenblatt wrote:
> On Fri, 8 Nov 2024 09:07:43 +0100, R.Wieser wrote:
> 
>>> HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\1.exe
>>> @Default = c:\path\seedclip_template1.bat
>> 
>> What is this preoccupation with the abuse of that "app paths" registry key ?
> 
> How the App Paths Registry Key Makes Windows Both Faster and Safer
> https://helgeklein.com/blog/how-the-app-paths-registry-key-makes-windows-both-faster-and-safer/

I don't see why it will make Windows "Faster and Safer".


>> Create a folder and add it to the PATH environment variable* (which is 
>> something you only need to do once).  After that you can just drop any 
>> program or batch file into it and start it using the "run" dialog (or from a 
>> command console) - no "app path" fumbling needed anymore.
> 
> The article cited explains why it's sophomoric to modify the PATH variable.

There is nothing explained.


> The App Paths key provides a per-process PATH configuration which increases
> security by eliminating the need to touch the global system PATH variable.

Why does this increase security?


A Windows App normally isn't just a single exe file but comes with a lot
of additional files, so it needs its own program directory. If you have
a lot of such Apps installed it would be indeed a stupid idea to add all
these program directories to the PATH variable. On the other side, if
you have dozens of single file utilities or batch files, then it would
be stupid, to spread them all over the disk and use a Registry entry
for each of them. Just put them all in a single command directory and
add it to the PATH variable.

When setting up a new PC, the first thing I do, is to copy this command
directory to the new PC and modify the PATH variable. Then my collection
of helper utilities is immediately available.



> When I want template #1 for example, I type "1" in the Runbox.
> When I want template #2, I type "2"; "3" for template #3, etc.

Instead of typing <WIN>-R I prefer to have a CMD window open all
the time. I simple click into the task bar brings it to foreground
so you can enter the commands. But when using the AppPath method
to register 1.exe, 2.exe and 3.exe you have to type "start 1",
"start 2" or "start 3", 1, 2 or 3 works only with the PATH method.
                                                        
                  




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


#179799

FromWolf Greenblatt <wolf@greenblatt.net>
Date2024-11-08 23:14 -0500
Message-ID<vgmnip$5uia$1@news.samoylyk.net>
In reply to#179789
On Fri, 8 Nov 2024 21:53:12 +0100, Herbert Kleebauer wrote:

>> How the App Paths Registry Key Makes Windows Both Faster and Safer
>> https://helgeklein.com/blog/how-the-app-paths-registry-key-makes-windows-both-faster-and-safer/
> 
> I don't see why it will make Windows "Faster and Safer".

I don't either. All I know is when Microsoft gave us the System Registry, I
studied how it works & one of the neat things I found was 'App Paths'.
https://docs.revenera.com/installshield22helplib/helplibrary/IHelpAddAppPathsToComponent.htm

I latched on to the convenience of the App Paths subkey & its portability.
https://learn.microsoft.com/en-us/windows/win32/shell/app-registration

This was so long ago that I don't remember if it was Windows XP or 95 or
what, but I made scores of commands those days I'm still using today.

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths
Used to register an application for a single user

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths
Used to register an application for all users of the computer 

I simply export the App Paths key from one machine & load it into another.
It just works. And I've been using literally that same key for decades.
https://superuser.com/questions/1642149/what-does-hklm-software-microsoft-windows-currentversion-app-paths-actually-do

You export from one machine. You import into the new machine.
And all your commands work the same on both machines.

Of course I also bring over my batch & link directories (which contain
almost every script ever proposed on the Windows newsgroups, by the way).

And, of course, you can screw with the PATH and they'd likely still work.
But I have never touched the PATH on Windows in decades as I don't need to.

>>> Create a folder and add it to the PATH environment variable* (which is 
>>> something you only need to do once).  After that you can just drop any 
>>> program or batch file into it and start it using the "run" dialog (or from a 
>>> command console) - no "app path" fumbling needed anymore.
>> 
>> The article cited explains why it's sophomoric to modify the PATH variable.
> 
> There is nothing explained.

Agree with you. 

You're different than that other guy who was just complaining so I didn't
take him seriously. I take you seriously as you're not just complaining.

You're trying to be critically constructive. And that's good. So am I.

Many of my programs are those you wrote that I found on the archives for
this newsgroup whenever I search for things - like your spelling program.

I love that it gives me three chances to spell a word and if I get it
right, then it removes the word from my misspelled word list.

It's great! I think you wrote half the batch scripts that I've used,
although others wrote them too (like Zaidy036) as I copy them verbatim and
then when they work for me verbatim, I then modify them as needed.

I think you wrote my sort program, for example, that sorts by microsecond.
And I think you wrote the program I use that gets rid of the command
console when I run commands which leave an unnecessary console in place.

I never understood that (as it makes use of certificates) - but it works!
 showwin.exe 5
 del showwin.exe
 goto :eof

 -----BEGIN CERTIFICATE-----
 TVpgAQEAAAAEAAAA//8AAGABAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 AAAAAAAAAAAAAAAAoAAAAA4fug4AtAnNIbgBTM0hTmljZSB0byBtZWV0IHNvbWVi
 b2R5IHdobyBpcyBzdGlsbCB1c2luZyBET1MsDQpidXQgdGhpcyBwcm9ncmFtIHJl
 cXVpcmVzIFdpbjMyLg0KJFBFAABMAQEAUHmlNgAAAAAAAAAA4AAPAQsBBQwAAgAA
 AAAAAAAAAADIEAAAABAAAAAgAAAAAEAAABAAAAACAAAFAAAAAAAAAAQAAAAAAAAA
 ACAAAAACAAAAAAAAAwAAAAAAEAAAEAAAAAAQAAAQAAAAAAAAEAAAAAAAAAAAAAAA
 GBAAADwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAYAAAA
 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALnRleHQAAAAmAQAAABAAAAACAAAAAgAA
 AAAAAAAAAAAAAAAAIAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABoEAAAAAAAAJQQAACmEAAA
 uhAAAAAAAABgEAAAAAAAAAAAAABUEAAAABAAAIQQAAAAAAAAAAAAAHYQAAAIEAAA
 AAAAAAAAAAAAAAAAAAAAAAAAAABVU0VSMzIuZGxsAABoEAAAAAAAAAAAU2hvd1dp
 bmRvdwAAS0VSTkVMMzIuZGxsAACUEAAAphAAALoQAAAAAAAAAABHZXRDb21tYW5k
 TGluZUEAAABHZXRDb25zb2xlV2luZG93AAAAAEV4aXRQcm9jZXNzAP8VCBBAADHS
 SECAOAB0EYA4InUC99IJ0nXvgDggdepAMfa9BQAAAA+2EEAI0nQTgOowcvOA+gl3
 7mv2CgHWMe3r5QntdAKJ7v8VDBBAAFZQ/xUAEEAAagD/FRAQQAAAAAAAAAAAAAAA
 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 AAAAAAAAAAAAAAAAAAAAAA==
 -----END CERTIFICATE----- 

Some day I'll actually understand what you did in the above that works.

But for now, I just type "x" in my Runbox to open the directory and then I
type the batch file that you wrote that runs what I need w/o the console!

(I never put the two together so that the Runbox command would do both
tasks of going to the directory and running the command - because it's NOT
in the PATH since I never mess with the path - which takes us full circle.)

>> The App Paths key provides a per-process PATH configuration which increases
>> security by eliminating the need to touch the global system PATH variable.
> 
> Why does this increase security?

I don't know. I was just trying to get rid of the guy who was complaining
about how Microsoft does the PATH. I told him to complain to Bill Gates.

I'm just using a feature of the PATH that I've been using for decades.
It's why I never have to modify the PATH.

> A Windows App normally isn't just a single exe file but comes with a lot
> of additional files, so it needs its own program directory. If you have
> a lot of such Apps installed it would be indeed a stupid idea to add all
> these program directories to the PATH variable. On the other side, if
> you have dozens of single file utilities or batch files, then it would
> be stupid, to spread them all over the disk and use a Registry entry
> for each of them. Just put them all in a single command directory and
> add it to the PATH variable.

That works too. But not every command is a batch file. Some are links. 
Links do things easily that batch files don't do as easily, although both
can be made to do everything I'm sure.

Where I use links is when I have to bring up the Windows task scheduler.

Usually I do that only to run commands which need admin privileges.
Or when I want to pin something to the taskbar that won't pin otherwise.

I'm not using the App Paths for any other reason than convenience.
And portability. 

Because the Windows App Paths key does more than just run batch files.

> When setting up a new PC, the first thing I do, is to copy this command
> directory to the new PC and modify the PATH variable. Then my collection
> of helper utilities is immediately available.

Yup. I do something similar in that I set up all my concurrent machines and
the new machine the same as I set it up on Windows XP and moved forward.

Over time, of course, there are tweaks (for example, the executable for
%Windir%\System32\curl.exe ifconfig.me didn't exist in early Windows 10),
but essentially the App Paths key contains everything I run every day.

We both accomplish that portability in a very consistent way.
Only different.

I never mess with the PATH. You do.
You never mess with the App Paths subkey. I do.

The end result is similar and only slightly different from your approach.
Your approach is typical. Mine is perhaps not as typical. Both work.

There are other methods also to find any given command on Windows.
https://learn.microsoft.com/en-us/windows/win32/shell/app-registration

>> When I want template #1 for example, I type "1" in the Runbox.
>> When I want template #2, I type "2"; "3" for template #3, etc.
> 
> Instead of typing <WIN>-R I prefer to have a CMD window open all
> the time. 

Rest assured I *never* type "Win+R". I just type that because most people
don't know anything about the runbox so it makes it clear for *them*.

I keep a runbox shortcut pinned to teh taskbar in a prominent spot.

(I just added "prominent" to my spelling list you created, as I had spelled
it "prominant" by mistake and it got squiggled so I added it to your list.)

> I simple click into the task bar brings it to foreground
> so you can enter the commands. But when using the AppPath method
> to register 1.exe, 2.exe and 3.exe you have to type "start 1",
> "start 2" or "start 3", 1, 2 or 3 works only with the PATH method.

Each method works. Neither is "abuse" of the mechanism Microsoft provided.

As the other guy already said, the best way to do this (using either
method) is to write a script that has as input which template you want.
 command template1
 command template2
 command template3

What would be a neat trick, although I don't need it, is to populate the
clipboard not with a "type file.txt | clip" but with a word document or an
excel spreadsheet (where "type" won't likely work for those templates).

I don't have that script but if someone posts it, I'll use it.
Most of my stuff is written by you & others like Zaidy03 <Eric@Bloch.com>.

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


#179807

FromZaidy036 <Zaidy036@air.isp.spam>
Date2024-11-09 10:20 -0500
Message-ID<vgnujl$3p1tp$1@dont-email.me>
In reply to#179799
On 11/8/2024 11:14 PM, Wolf Greenblatt wrote:
> On Fri, 8 Nov 2024 21:53:12 +0100, Herbert Kleebauer wrote:
> 
>>> How the App Paths Registry Key Makes Windows Both Faster and Safer
>>> https://helgeklein.com/blog/how-the-app-paths-registry-key-makes-windows-both-faster-and-safer/
>>
>> I don't see why it will make Windows "Faster and Safer".
> 
> I don't either. All I know is when Microsoft gave us the System Registry, I
> studied how it works & one of the neat things I found was 'App Paths'.
> https://docs.revenera.com/installshield22helplib/helplibrary/IHelpAddAppPathsToComponent.htm
> 
> I latched on to the convenience of the App Paths subkey & its portability.
> https://learn.microsoft.com/en-us/windows/win32/shell/app-registration
> 
> This was so long ago that I don't remember if it was Windows XP or 95 or
> what, but I made scores of commands those days I'm still using today.
> 
> HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths
> Used to register an application for a single user
> 
> HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths
> Used to register an application for all users of the computer
> 
> I simply export the App Paths key from one machine & load it into another.
> It just works. And I've been using literally that same key for decades.
> https://superuser.com/questions/1642149/what-does-hklm-software-microsoft-windows-currentversion-app-paths-actually-do
> 
> You export from one machine. You import into the new machine.
> And all your commands work the same on both machines.
> 
> Of course I also bring over my batch & link directories (which contain
> almost every script ever proposed on the Windows newsgroups, by the way).
> 
> And, of course, you can screw with the PATH and they'd likely still work.
> But I have never touched the PATH on Windows in decades as I don't need to.
> 
>>>> Create a folder and add it to the PATH environment variable* (which is
>>>> something you only need to do once).  After that you can just drop any
>>>> program or batch file into it and start it using the "run" dialog (or from a
>>>> command console) - no "app path" fumbling needed anymore.
>>>
>>> The article cited explains why it's sophomoric to modify the PATH variable.
>>
>> There is nothing explained.
> 
> Agree with you.
> 
> You're different than that other guy who was just complaining so I didn't
> take him seriously. I take you seriously as you're not just complaining.
> 
> You're trying to be critically constructive. And that's good. So am I.
> 
> Many of my programs are those you wrote that I found on the archives for
> this newsgroup whenever I search for things - like your spelling program.
> 
> I love that it gives me three chances to spell a word and if I get it
> right, then it removes the word from my misspelled word list.
> 
> It's great! I think you wrote half the batch scripts that I've used,
> although others wrote them too (like Zaidy036) as I copy them verbatim and
> then when they work for me verbatim, I then modify them as needed.
> 
> I think you wrote my sort program, for example, that sorts by microsecond.
> And I think you wrote the program I use that gets rid of the command
> console when I run commands which leave an unnecessary console in place.
> 
> I never understood that (as it makes use of certificates) - but it works!
>   showwin.exe 5
>   del showwin.exe
>   goto :eof
> 
>   -----BEGIN CERTIFICATE-----
>   TVpgAQEAAAAEAAAA//8AAGABAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
>   AAAAAAAAAAAAAAAAoAAAAA4fug4AtAnNIbgBTM0hTmljZSB0byBtZWV0IHNvbWVi
>   b2R5IHdobyBpcyBzdGlsbCB1c2luZyBET1MsDQpidXQgdGhpcyBwcm9ncmFtIHJl
>   cXVpcmVzIFdpbjMyLg0KJFBFAABMAQEAUHmlNgAAAAAAAAAA4AAPAQsBBQwAAgAA
>   AAAAAAAAAADIEAAAABAAAAAgAAAAAEAAABAAAAACAAAFAAAAAAAAAAQAAAAAAAAA
>   ACAAAAACAAAAAAAAAwAAAAAAEAAAEAAAAAAQAAAQAAAAAAAAEAAAAAAAAAAAAAAA
>   GBAAADwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
>   AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAYAAAA
>   AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALnRleHQAAAAmAQAAABAAAAACAAAAAgAA
>   AAAAAAAAAAAAAAAAIAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
>   AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABoEAAAAAAAAJQQAACmEAAA
>   uhAAAAAAAABgEAAAAAAAAAAAAABUEAAAABAAAIQQAAAAAAAAAAAAAHYQAAAIEAAA
>   AAAAAAAAAAAAAAAAAAAAAAAAAABVU0VSMzIuZGxsAABoEAAAAAAAAAAAU2hvd1dp
>   bmRvdwAAS0VSTkVMMzIuZGxsAACUEAAAphAAALoQAAAAAAAAAABHZXRDb21tYW5k
>   TGluZUEAAABHZXRDb25zb2xlV2luZG93AAAAAEV4aXRQcm9jZXNzAP8VCBBAADHS
>   SECAOAB0EYA4InUC99IJ0nXvgDggdepAMfa9BQAAAA+2EEAI0nQTgOowcvOA+gl3
>   7mv2CgHWMe3r5QntdAKJ7v8VDBBAAFZQ/xUAEEAAagD/FRAQQAAAAAAAAAAAAAAA
>   AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
>   AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
>   AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
>   AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
>   AAAAAAAAAAAAAAAAAAAAAA==
>   -----END CERTIFICATE-----
> 
> Some day I'll actually understand what you did in the above that works.
> 
> But for now, I just type "x" in my Runbox to open the directory and then I
> type the batch file that you wrote that runs what I need w/o the console!
> 
> (I never put the two together so that the Runbox command would do both
> tasks of going to the directory and running the command - because it's NOT
> in the PATH since I never mess with the path - which takes us full circle.)
> 
>>> The App Paths key provides a per-process PATH configuration which increases
>>> security by eliminating the need to touch the global system PATH variable.
>>
>> Why does this increase security?
> 
> I don't know. I was just trying to get rid of the guy who was complaining
> about how Microsoft does the PATH. I told him to complain to Bill Gates.
> 
> I'm just using a feature of the PATH that I've been using for decades.
> It's why I never have to modify the PATH.
> 
>> A Windows App normally isn't just a single exe file but comes with a lot
>> of additional files, so it needs its own program directory. If you have
>> a lot of such Apps installed it would be indeed a stupid idea to add all
>> these program directories to the PATH variable. On the other side, if
>> you have dozens of single file utilities or batch files, then it would
>> be stupid, to spread them all over the disk and use a Registry entry
>> for each of them. Just put them all in a single command directory and
>> add it to the PATH variable.
> 
> That works too. But not every command is a batch file. Some are links.
> Links do things easily that batch files don't do as easily, although both
> can be made to do everything I'm sure.
> 
> Where I use links is when I have to bring up the Windows task scheduler.
> 
> Usually I do that only to run commands which need admin privileges.
> Or when I want to pin something to the taskbar that won't pin otherwise.
> 
> I'm not using the App Paths for any other reason than convenience.
> And portability.
> 
> Because the Windows App Paths key does more than just run batch files.
> 
>> When setting up a new PC, the first thing I do, is to copy this command
>> directory to the new PC and modify the PATH variable. Then my collection
>> of helper utilities is immediately available.
> 
> Yup. I do something similar in that I set up all my concurrent machines and
> the new machine the same as I set it up on Windows XP and moved forward.
> 
> Over time, of course, there are tweaks (for example, the executable for
> %Windir%\System32\curl.exe ifconfig.me didn't exist in early Windows 10),
> but essentially the App Paths key contains everything I run every day.
> 
> We both accomplish that portability in a very consistent way.
> Only different.
> 
> I never mess with the PATH. You do.
> You never mess with the App Paths subkey. I do.
> 
> The end result is similar and only slightly different from your approach.
> Your approach is typical. Mine is perhaps not as typical. Both work.
> 
> There are other methods also to find any given command on Windows.
> https://learn.microsoft.com/en-us/windows/win32/shell/app-registration
> 
>>> When I want template #1 for example, I type "1" in the Runbox.
>>> When I want template #2, I type "2"; "3" for template #3, etc.
>>
>> Instead of typing <WIN>-R I prefer to have a CMD window open all
>> the time.
> 
> Rest assured I *never* type "Win+R". I just type that because most people
> don't know anything about the runbox so it makes it clear for *them*.
> 
> I keep a runbox shortcut pinned to teh taskbar in a prominent spot.
> 
> (I just added "prominent" to my spelling list you created, as I had spelled
> it "prominant" by mistake and it got squiggled so I added it to your list.)
> 
>> I simple click into the task bar brings it to foreground
>> so you can enter the commands. But when using the AppPath method
>> to register 1.exe, 2.exe and 3.exe you have to type "start 1",
>> "start 2" or "start 3", 1, 2 or 3 works only with the PATH method.
> 
> Each method works. Neither is "abuse" of the mechanism Microsoft provided.
> 
> As the other guy already said, the best way to do this (using either
> method) is to write a script that has as input which template you want.
>   command template1
>   command template2
>   command template3
> 
> What would be a neat trick, although I don't need it, is to populate the
> clipboard not with a "type file.txt | clip" but with a word document or an
> excel spreadsheet (where "type" won't likely work for those templates).
> 
> I don't have that script but if someone posts it, I'll use it.
> Most of my stuff is written by you & others like Zaidy03 <Eric@Bloch.com>.

Thanks for the mention.
If I was doing something similar I would use one batch and its first 
step would be to ask how many (0-9) , kill batch if 0 otherwise use the 
number to do what I want. Why have multiple batches when one will work 
and take less file space? The make a shortcut to start the batch and 
perhaps also a "Shortcut Key" which would give efficient activation.+

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


#180179

FromWolf Greenblatt <wolf@greenblatt.net>
Date2024-11-25 17:50 -0500
Message-ID<vi2v01$e6n8$1@news.samoylyk.net>
In reply to#179807
On Sat, 9 Nov 2024 10:20:21 -0500, Zaidy036 wrote:

>> Most of my stuff is written by you & others like Zaidy03 <Eric@Bloch.com>.
> 
> Thanks for the mention.
> If I was doing something similar I would use one batch and its first 
> step would be to ask how many (0-9) , kill batch if 0 otherwise use the 
> number to do what I want. Why have multiple batches when one will work 
> and take less file space? The make a shortcut to start the batch and 
> perhaps also a "Shortcut Key" which would give efficient activation.+

Thanks for noticing. I keep in my REM comments the name of the person 
who helped as I've tried at least once probably every script posted 
to this ng.

Thanks for contributing to the newsgroup so we can find your stuff 
when we search the archives for your name and some related batch 
keyword!

This one, for example, is by you based on the comments in the file.

 @echo off
 REM nettoggle.bat by Zaidy036 20210207 on alt.comp.os.windows-10
 REM Win10 network on/off toggle with admin privileges, Feb 7, 2021
 REM https://groups.google.com/g/alt.msdos.batch/c/sDNRLfXlUHo
 REM With an attempt to get admin privileges programmatically
 REM https://stackoverflow.com/questions/22367173/get-default-gateway-from-batch-file
 REM for /f "tokens=1-5" %%a in ('route -4 print 0.*') do @if "%%e"=="" if "%%a"=="%%b" set "ip=%%c"

 :: Verify permissions
 >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
 
 :: On Error No Admin
 if '%errorlevel%' NEQ '0' (
     echo Getting administrative privileges...
     goto DoUAC
 ) else ( goto getAdmin )
 
 :DoUAC
     echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
     set params = %*:"=""
     echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
 
     "%temp%\getadmin.vbs"
     del "%temp%\getadmin.vbs"
     exit /B
 
 :getAdmin
     pushd "%CD%"
     CD /D "%~dp0"
 REM 
 set defgw=192.168.0.1
 set "ip="
 for /f "tokens=2,3 delims={,}" %%a in ('"WMIC NICConfig where IPEnabled="True" get DefaultIPGateway /value | find "I" "') do if not defined ip set ip=%%~a
 IF "%ip%"=="%defgw%" ( %comspec% /c %windir%\system32\route.exe delete 0.0.0.0 %defgw%) ELSE ( %comspec% /c %windir%\system32\route.exe add 0.0.0.0 mask 0.0.0.0 %defgw%)
 exit

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


#179808

FromHerbert Kleebauer <klee@unibwm.de>
Date2024-11-09 16:35 +0100
Message-ID<vgnvg5$3rhe7$1@dont-email.me>
In reply to#179799
On 09.11.2024 05:14, Wolf Greenblatt wrote:
> On Fri, 8 Nov 2024 21:53:12 +0100, Herbert Kleebauer wrote:

I remove the cross post to alt.comp.os.windows-11 because I think,
everybody who reads the Win11 group also reads the Win10 group
(and because my Thunderbird refuses to do this cross post, I have
to manually insert the second group in the posting stored in
the Outbox).

I also will split the answer in more postings to make it
better readable.


> I simply export the App Paths key from one machine & load it into another.
> It just works. 

If you have to manually select just your entries, then this is
not a "simply" task.


> You export from one machine. You import into the new machine.
> And all your commands work the same on both machines.

But it is much more work than just editing the PATH. And you
have to modify the registry every time you add or delete a
utility.



>> I simple click into the task bar brings it to foreground
>> so you can enter the commands. But when using the AppPath method
>> to register 1.exe, 2.exe and 3.exe you have to type "start 1",
>> "start 2" or "start 3", 1, 2 or 3 works only with the PATH method.
> 
> Each method works. Neither is "abuse" of the mechanism Microsoft provided.

No, just typing 1,2 or 3 in a cmd window doesn't work if you
use the AppPath method instead of PATH. CMD doesn't look into
the registry.


> As the other guy already said, the best way to do this (using either
> method) is to write a script that has as input which template you want.
>   command template1
>   command template2
>   command template3

Not if there are just a few templates (because you have to type more).

With your example:
If 1.bat, 2.bat and 3.bat should insert 10, 20 or 30 separator lines.
I would just make one batch file with the name 0.bat and this content:

@echo off
set /a n=%~n0% * 10
if %n%==0 set /p n=How much lines?
(for /l %%i in (1,1,%n%) do @echo ==============================&echo.)|clip
pause

Then generate 3 more names for the file:
  
mklink /h 1.bat 0.bat
mklink /h 2.bat 0.bat
mklink /h 3.bat 0.bat

It is still only one file but with four names. It doesn't matter
which one you edit, the content is always identical.

But if you start the batch by the name 1.bat, 10 lines are stored
in the clipboard. 2.bat stores 20 and 3.bat 30 lines. If you start
it by 0.bat, you are asked for the number.



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


#179809

FromHerbert Kleebauer <klee@unibwm.de>
Date2024-11-09 16:36 +0100
Message-ID<vgnvht$3rhe7$2@dont-email.me>
In reply to#179799
On 09.11.2024 05:14, Wolf Greenblatt wrote:
> On Fri, 8 Nov 2024 21:53:12 +0100, Herbert Kleebauer wrote:



> I never understood that (as it makes use of certificates) - but it works!
>   showwin.exe 5
>   del showwin.exe
>   goto :eof
> 
>   -----BEGIN CERTIFICATE-----
>   TVpgAQEAAAAEAAAA//8AAGABAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

> Some day I'll actually understand what you did in the above that works.

It doesn't make use of certificates, it just uses the built-in base64
decoder of certutil.exe. The base64 characters between

-----BEGIN CERTIFICATE-----
and
  -----END CERTIFICATE-----

are converted back to binary and stored as an exe file. This way
small exe programs can be embedded within the batch. showwin.exe
just calls the ShowWindow function in USER32.dll with the
parameter given in the command line.

https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-showwindow

winmain::
         jsr.l   (GetCommandLine)
                                 ; skip program name
         eor.l   r1,r1           ; not within "" flag
         dec.l   r0
_20:    inc.l   r0
         cmp.b   #0,(r0)
         beq.b   _10
         cmp.b   #'"',(r0)
         bne.b   _30
         not.l   r1
_30:    or.l    r1,r1
         bne.b   _20
         cmp.b   #' ',(r0)
         bne.b   _20
         inc.l   r0

_10:    eor.l   r5,r5
         move.l  #5,r4           ; default: SW_SHOW
_50:    movu.bl (r0),r1
         inc.l   r0
         or.b    r1,r1
         beq.b   _40
         sub.b   #'0',r1
         bcs.b   _50
         cmp.b   #9,r1
         bhi.b   _50
         mulsq.l #10,r5,r5
         add.l   r1,r5
         eor.l   r4,r4
         br.b    _50
_40:    or.l    r4,r4
         beq.b   _60
         move.l  r4,r5

_60:    jsr.l   (GetConsoleWindow)
         
         move.l  r5,-(sp)
         move.l  r0,-(sp)
         jsr.l   (ShowWindow)

         moveq.l #0,-(sp)
         jsr.l   (ExitProcess)   ; exit program





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


#179810

FromHerbert Kleebauer <klee@unibwm.de>
Date2024-11-09 16:37 +0100
Message-ID<vgnvk0$3rhe7$3@dont-email.me>
In reply to#179799
On 09.11.2024 05:14, Wolf Greenblatt wrote:
> On Fri, 8 Nov 2024 21:53:12 +0100, Herbert Kleebauer wrote:


  
> What would be a neat trick, although I don't need it, is to populate the
> clipboard not with a "type file.txt | clip" but with a word document or an
> excel spreadsheet (where "type" won't likely work for those templates).

A simple way would be to send the keystrokes <CTRL>-A  <CRTL>-C  <ALt>-F4
to Word. This batch works with Word from Office 2007. Maybe you have
to change the delay time for big docx files.


@echo off
if not exist skeyword.exe certutil -f -decode %~f0 skeyword.exe>nul
start "" winword.exe test.docx
:: wait for Word to start and load test.docx file
timeout 10
skeyword.exe
::del skeyword.exe
::pause
goto :eof

-----BEGIN CERTIFICATE-----
TVpgAQEAAAAEAAAA//8AAGABAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAoAAAAA4fug4AtAnNIbgBTM0hTmljZSB0byBtZWV0IHNvbWVi
b2R5IHdobyBpcyBzdGlsbCB1c2luZyBET1MsDQpidXQgaGlzIHByb2dyYW0gcmVx
dWlyZXMgV2luMzIuDQokAFBFAABMAQEAUHmlNgAAAAAAAAAA4AAPAQsBBQwAAgAA
AAAAAAAAAACgEAAAABAAAAAgAAAAAEAAABAAAAACAAAFAAAAAAAAAAQAAAAAAAAA
ACAAAAACAAAAAAAAAwAAAAAAEAAAEAAAAAAQAAAQAAAAAAAAEAAAAAAAAAAAAAAA
FBAAADwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAUAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALnRleHQAAACnAQAAABAAAAACAAAAAgAA
AAAAAAAAAAAAAAAAIAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABkEAAAAAAAAIoQAACSEAAA
AAAAAFwQAAAAAAAAAAAAAFAQAAAAEAAAfhAAAAAAAAAAAAAAcBAAAAgQAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAFVTRVIzMi5kbGwAAGQQAAAAAAAAAABTZW5kSW5wdXQA
S0VSTkVMMzIuZGxsAACKEAAAkhAAAAAAAAAAAFNsZWVwAAAARXhpdFByb2Nlc3MA
vpcRQABoZAAAAP8VCBBAALkCAAAAv18RQACsCMAPhJMAAAA8PXUMuQEAAAC/XxFA
AOvnPF51DLkBAAAAv3sRQADr1zw/dQ0xwKwIwHRoa8BkUOu2PDx1DrAQuQEAAAC/
XxFAAOs0PD51DrAQuQEAAAC/exFAAOsiPDp1DrARuQEAAAC/XxFAAOsQPDt1DLAR
uQEAAAC/exFAAKJjEUAAon8RQABoHAAAAFdR/xUAEEAA6U////9qAFb/FQwQQAAB
AAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAEQAAAACAAAAAAAAAAAAAAAA
AAAAAAAAADpBOz8UOkM7PxQ9EnNeEgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAA==
-----END CERTIFICATE-----


If you need to change the keys sent to word, edit the source
code skeyword.mac and start the batch makeskeyword.bat, then
the above batch is generated automatically. you will find
both (and the assembler windela.exe) in:

http://onlib.de/temp/skeyword.zip

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


#179811

FromHerbert Kleebauer <klee@unibwm.de>
Date2024-11-09 16:38 +0100
Message-ID<vgnvlj$3rhe7$4@dont-email.me>
In reply to#179799
On 09.11.2024 05:14, Wolf Greenblatt wrote:
> On Fri, 8 Nov 2024 21:53:12 +0100, Herbert Kleebauer wrote:



> Many of my programs are those you wrote that I found on the archives for
> this newsgroup whenever I search for things - like your spelling program.

Maybe this calendar program is also useful. Depending on your
date format you have to modify the 3 lines below. And you
have to insert the birthdays of your friend at the end of the
batch.


@echo off
:: MODE doesn't work in Win11
:: MODE CON: COLS=40 LINES=40
setlocal

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: usage:
:: kalender.bat          show current month
:: kalender.bat  9       show month september of current year
:: kalender.bat  4 2007  show month april of year 2007
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: the format of the %date% variable must be in the following format:
:: set date=28.02.2001
:: if not, change the next three lines
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
set /a y=%date:~6,4%
set /a m=1%date:~3,2%-100
set /a d=1%date:~0,2%-100
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: test for parameter month
if  not [%1]==[] set /a m=%1
if %m% lss 1 goto :eof
if %m% gtr 12 goto :eof
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: test for parameter year
if  not [%2]==[] set /a y=%2
if %y% lss 1901 goto :eof
if %y% gtr 2100 goto :eof
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: calculate the string for the week numbers
setlocal
(set t= )
for /l %%i in (1,7,29) do (
  set d=%%i
  call :date2week
  call set v= %%v%%
  call set v=%%v:~-2%%
  call set t=%%t%%%%v%%:                         )
endlocal & (set t=%t%    )
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: calculate the name of the first day of month %m% 0:monday 7:sunday
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
call  :date2day
set /a w=(w-d+2)%%7

set m[1]=Januar & set m[2]=Februar & set m[3]=Maerz & set m[4]=April
set m[5]=Mai & set m[6]=Juni & set m[7]=Juli & set m[8]=August
set m[9]=September&set m[10]=Oktober&set m[11]=November&set m[12]=Dezember

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: calculate the number of days in the month %m%
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
set /a n=28+(62648012^>^>(2*%m%)^&3)+ (!(%y% %% 4))*(!(%m%-2))


::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: calculate the string for the days
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
(set s= )
for /l %%i in (1,1,%w%) do (call set s=    %%s%%)
for /l %%i in (1,1,9) do if %%i EQU %d% (
            call set s=%%s%%[ %%i]) else (call set s=%%s%%  %%i )
for /l %%i in (10,1,%n%) do if %%i EQU %d% (
            call set s=%%s%%[%%i]) else (call set s=%%s%% %%i )

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: output the calendar
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo.&echo.
call echo            %%m[%m%]%% %y%
echo      Mo  Di  Mi  Do  Fr  Sa  So
for /l %%i in (1,28,141) do (call echo.%%t:~%%i,4%%%%s:~%%i,28%%)
echo.


::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: output public holidays and bithdays
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
set /a month=m
if %m% lss 10 set month=0%m%
set /a m=3
set /a d=1
call :date2day
call :ostern
set /a o=w+o-1

set i=.
for /f "tokens=2,3* delims=. " %%i in ('find "::%i%"^<"%~f0"') do (
  set /a d=%%i
  set /a m=%%j
  set  name=%%k
  call :sub)
pause
goto :eof


:sub
if not %m%==0 if %d%==0 echo.&goto :eof
if %m% lss 10 set m=0%m%
if %d% lss 10 set d=0%d%
if [%m%]==[%month%] echo  %d%.%m%.%y%  %name%
if not [%m%]==[00] goto :eof
set /a w=o+%d%
call :day2date
if %m% lss 10 set m=0%m%
if %d% lss 10 set d=0%d%
if [%m%]==[%month%] echo  %d%.%m%.%y%  %name%
goto :eof



:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: calculate the date of eastern in the year %y%               ::
:: 1: 1. march   31: 31. march   32: 1. april    ...           ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:ostern
set /a i=((y%%19)*19+15+((y/100)*3+3)/4-((y/100)*8+13)/25)%%30
set /a j=21+i-(i/29+(i/28-i/29)*((y%%19)/11))
set /a o=j+7-(j-(7-(y+y/4+2-((y/100)*3+3)/4)%%7))%%7
goto :eof

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: convert the date in %y% %m% %d% to the number of days (%w%) ::
:: since 1901  (day 0 is 1. Jan. 1901)                         ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:date2day
set /a w=(y-1901)*365+(y-1901)/4+d-1+(!(y %% 4))*(!((m-3)^&16))
set /a w=w+(m-1)*30+2*(!((m-7)^&16))-1+((65611044^>^>(2*m))^&3)
goto :eof

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: convert the number of days in %w% to the date (%y% %m% %d%) ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:day2date
set /a x=w/1461
set /a w=w-x*1461
set /a z=w/365-((w/365)^>^>2)
set /a w=w-z*365
set /a y=1901+x*4+z
set /a v=w-!(y%%4)
set /a m=!!(w/31)+!!(v/59)+!!(v/90)+!!(v/120)+!!(v/151)+!!(v/181)
set /a m=m+!!(v/212)+!!(v/243)+!!(v/273)+!!(v/304)+!!(v/334)+1
set /a d=w+1-(!(y%%4))*(!((m-3)^&16))
set /a d=d-((m-1)*30+2*(!((m-7)^&16))-1+((65611044^>^>(2*m))^&3))
goto :eof

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: calculate the week number %v% for the date (%y% %m% %d%)    ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:date2week
setlocal
call :date2day
set i=%w%
set d=1
set m=1
call :date2day
set /a n=(w+1)%%7
set /a v=!(n/4)
set /a v=v+(i-w+n)/7

if %v% gtr 0 goto :d2w1
set v=53
if %n%==4 goto :d2w2
set /a y=y-1
call :date2day
set /a n=(w+1)%%7
if %n%==3 goto :d2w2
set v=52
goto :d2w2

:d2w1
if %v% leq 52 goto :d2w2
if %n%==3 goto :d2w2
set /a y=y+1
call :date2day
set /a n=(w+1)%%7
if %n%==4 goto :d2w2
set v=1

:d2w2
endlocal & set v=%v%
goto :eof

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: insert holidays and birthdays here                          ::
:: format: ::. day.month.  description                         ::
:: if month==0 then day is the offset to eastern               ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

::.  1.1.   Neujahr
::.  6.1.   Hl. 3 Koenige
::. 14.2.   Valentinstag
::.-48.0.   Rosenmontag
::.-47.0.   Faschingsdienstag
::. -2.0.   Karfreitag
::. -1.0.   Karsamstag
::.  0.0.   Ostersonntag
::.  1.0.   Ostermontag
::.  1.5.   Maifeiertag
::. 39.0.   Christi Himmelfahrt
::. 49.0.   Pfingstsonntag
::. 50.0.   Pfingstmontag
::. 60.0.   Fronleichnam
::. 15.8.   Maria Himmelfahrt
::.  3.10.  Tag d. dt. Einheit
::.  1.11.  Allerheiligen
::. 24.12.  Heiligabend
::. 25.12.  1. Weihnachtstag
::. 26.12.  2. Weihnachtstag
::. 31.12.  Silvester

::.  0.1.  just an empty line

::.  3.1. Emilia
::.  16.1. Noah
::.  22.1. Emma
::.  27.1. Leon
::.  12.2. Mia
::.  22.2. Liam
::.  22.2. Lina
::.  10.3. Leo
::.  16.3. Ella
::.  19.3. Milan
::.  20.3. Mila
::.  22.4. Emil
::.  27.4. Malia
::.  27.4. Felix
::.  2.5. Leni
::.  10.5. Luca
::.  19.5. Amelie
::.  8.6. Theo
::.  12.6. Leonie
::.  28.6. Matteo
::.  6.7. Luna
::.  15.7. Paul
::.  18.7. Hannah
::.  29.7. Emilio
::.  14.8. Sophie
::.  23.8. Henry
::.  3.9. Amalia
::.  12.9. David
::.  10.10. Sophia
::.  2.11. Jonas
::.  27.11. Charlotte
::.  11.12. Oskar
::.  11.12. Hanna
::.  24.12. Maximilian
::.  30.12. Lena

::.  0.1.  just an empty line
   


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


#180180

FromWolf Greenblatt <wolf@greenblatt.net>
Date2024-11-25 18:04 -0500
Message-ID<vi2vq8$e8ig$1@news.samoylyk.net>
In reply to#179799
On Mon, 25 Nov 2024 22:42:09 +0100, Herbert Kleebauer wrote:

> On 09.11.2024 05:14, Wolf Greenblatt wrote:
> 
>> Many of my programs are those you wrote that I found on the archives for
>> this newsgroup whenever I search for things - like your spelling program.
>> 
>> I love that it gives me three chances to spell a word and if I get it
>> right, then it removes the word from my misspelled word list.
> 
> Just found out, that it doesn't work properly in Win11, you have to
> insert a small pause before the word is spoken:
> 
> cscript //nologo speak.vbs  "<silence msec='700'/> %*"
> 
>:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
> 
> @echo off
>:: you have to create spell.txt with the words to be spoken
>:: enter x to terminate program
> 
> chcp 65001>nul
>:: win11 Terminal doesn't support mode con
>:: MODE CON: COLS=50 LINES=10
>:: color f0
> cls
> 
>::echo createobject("sapi.spvoice").speak wsh.arguments(0)>speak.vbs
> 
>:: or with rate/volume specified
> echo Set sapi = createObject("sapi.spvoice") >speak.vbs
> echo sapi.Rate = -3 >>speak.vbs
>::echo sapi.Volume = 100 >>speak.vbs
> echo sapi.Speak wsh.arguments(0) >>speak.vbs
> 
> for /f "tokens=*" %%i in (spell.txt) do call echo %%random%% %%i>>spellerr.txt
> sort /o spelltmp.txt spellerr.txt
> del spellerr.txt
> set /a ok=0
> set /a not_ok=0
> 
> for /f "tokens=1*" %%i in (spelltmp.txt) do call :sub %%j
>:end
> del speak.vbs
> del spelltmp.txt
> echo.
> echo %ok% Wörter richtig,  %not_ok% Wörter falsch
> echo.
> pause
> exit
> 
>:sub
> echo.
> set /a n=0
>:sub1
> set /a n=n+1
> if %n%==3 goto :sub2
>:: https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ms717077(v=vs.85)
> cscript //nologo speak.vbs  "<silence msec='700'/> %*"
> set a=
> set /p a=
> if /i "%a%"=="x" goto :end
> if /i not "%*"=="%a%" goto :sub1
> set /a ok=ok+1
> goto :eof
> 
>:sub2
> echo 0 %*>>spellerr.txt
> echo ---------- %*
> set /a not_ok=not_ok+1
> timeout /t 2 >nul

Thanks for that update. I'm on Windows 10 so I wasn't aware of this change.
I'll fix mine so that when I move to Windows 11, it will still work.
The way I run it is I have an app paths key called "spell".

So I bring up the Runbox and then I type "spell" to add a squiggled word.
 HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\
 spell.exe = C:\path-to\spelltxt.txt

Then when I have time, type "bee" to test my personal spelling errors.
 HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\
 bee.exe = C:\path-to\spellingbee.bat

 @echo off
 REM spellingbee.bat for Windows 10, originally by Herbert Kleebauer 20220211 
 REM A self-test of redsquiggled words with a self-reinforcing misspelled DB.
 REM  Newsgroups: alt.comp.os.windows-10,alt.msdos.batch,alt.usage.english
 REM  Message-ID: <su5ifp$300$1@gioia.aioe.org>
 REM Customized for only the words that YOU misspell (just yours!)
 REM   Randomly speaks thos words giving you a chance to type them correctly.
 REM   Strategy being it _must_ be quick & easy; otherwise you won't do it.
 REM   Purposefully uses audio instead of a visual to present the word.
 REM   Strategically, this uses a visual to reinforce the correct spelling.
 REM   Logic being that seeing it _before_ trying to spell it taints memory.
 REM   Logic being seeing it _after_ an attempt tends to reinforce memory.
 REM   Tactic is auto-honing of just the words _you_ have recently misspelled.
 REM   Tactic is repetition specifically for the words _you_ misspelled most.
 REM Recommended one-time setup: 
 REM 1. Set up an AppPath for a quick command: "Run > spell"  
 REM     (Use that command to add redsquiggled words into spelltxt.txt)
 REM     HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\
 REM     spell.exe = C:\data\database\tts\spelltxt.txt
 REM 2. Set up an AppPath for a quick command: "Run > spellingbee"  
 REM     (Use that command to initiate the audio-visual testing process)
 REM     HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\
 REM     spellingbee.exe = C:\data\database\tts\spellingbee.bat
 REM 3. Optionally, choose a filespecs for the spell txt, err & tmp files
 REM     Note any explicit path is optional (it can be %TEMP% as the default).
 REM      spelltxt.txt is manually maintained redsquiggled words (1 per line)
 REM      spelltxt.err is a dynamic error file autocreated & automaintained
 REM      spelltxt.tmp is a dynamic tmp file autocreated by this script
 REM     Note: %TEMP% defaults to C:\Users\<username>\AppData\Local\Temp\
 REM Recommended daily-use model
 REM 4. Ad hoc, as words are redsquiggled, rightclick, correct & copy...
 REM     Run > spell
 REM     Paste the now-correctly-spelled redsquiggle into that spell.txt file
 REM     Note: Most people pin a "Run" shortcut icon to their Win10 taskbar.
 REM     Note: Otherwise, they press "Windows+R" to pop up the Run box.
 REM 5. Periodically, as needed, to refresh & reinforce spelling memory...
 REM     Run > spellingbee
 REM     a. Speaks words you previously doubly misspelled (in spellerr.txt)
 REM        (if you spell it incorrectly, another entry is added)
 REM        (if you spell it correctly, only one entry is removed)
 REM     b. Then randomly speaks the list of misspelled words (in spelltxt.txt)
 REM        (if you spell it incorrectly, one entry is added to the error file)
 REM        (if you spell it correctly, it moves to the next word in the file)
 REM     The more you misspell a word, the more it shows up in the error file.
 REM     Each time a word is presented you have two chances to spell it out.
 REM     The more you correctly spell it, the less it shows up.
 REM     When incorrect, a "pause" allows timely introspection of errors.
 REM     Pressing "x" will end the session (as will pressing "Control+C").
 REM  
 REM Please choose a desired filespec for the spelling text, error & temp files.
 REM set spelltxtfile=%TEMP%\spelltxt.txt
 REM set spellerrfile=%TEMP%\spellerr.txt
 REM set spelltmpfile=%TEMP%\spelltmp.txt
 set spelltxtfile=C:\data\database\tts\spelltxt.txt
 set spellerrfile=C:\data\database\tts\spellerr.txt
 set spelltmpfile=C:\data\database\tts\spelltmp.txt
 MODE CON: COLS=50 LINES=10
 color f0
 cls
 echo createobject("sapi.spvoice").speak wsh.arguments(0)>speak.vbs
 
 for /f "tokens=*" %%i in (%spelltxtfile%) do call echo %%random%% %%i>>%spellerrfile%
 sort /o %spelltmpfile% %spellerrfile%
 del %spellerrfile%
 set /a ok=0
 set /a not_ok=0
 
 for /f "tokens=1*" %%i in (%spelltmpfile%) do call :sub %%j
 :end
 del speak.vbs
 del %spelltmpfile%
 echo.
 echo %ok% words correct,  %not_ok% words incorrect
 echo.
 pause
 exit
 
 :sub
 echo.
 set /a n=0
 :sub1
 set /a n=n+1
 if %n%==3 goto :sub2
 cscript //nologo speak.vbs "%*"
 set a=
 set /p a=
 if /i "%a%"=="x" goto :end
 if /i not "%*"=="%a%" goto :sub1
 set /a ok=ok+1
 goto :eof
 
 :sub2
 echo 0 %*>>%spellerrfile%
 echo ---------- %*
 timeout /t 4 >nul
 set /a not_ok=not_ok+1

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

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


csiph-web