View Single Post
  #4  
Old April 15th 20, 02:34 AM posted to alt.msdos.batch,alt.comp.os.windows-10,microsoft.public.windowsxp.general
Arlen Holder[_7_]
external usenet poster
 
Posts: 141
Default Can a Windows batch script perform the equivalent of a cat until the end of file delimiter (cat foo eof)?

In response to what Herbert Kleebauer wrote :

I suppose that is not what you really want.


Hi Herbert Kleebauer,

Thank you for being a purposefully helpful person, with Windows knowledge.

Yes, you are correct in surmising that the ultimate goal is something
anyone can use to make it just a bit more difficult for timezone browser
fingerprinters by randomly switching the system time zone.

Since the system time zone will fluctuate, I've already solved the problem
of displaying a static local time clock on the Windows taskbar which is
completely independent of the system time zone.
o Tutorial for duplicating a Windows taskbar clock in any desired timezone
https://groups.google.com/d/msg/alt.comp.freeware/LmfYs2a4o0Q/PWjh38zQBwAJ
Where both the spoofed and actual system time can easily be displayed:
https://i.postimg.cc/9f6KJx4f/clock02.jpg

I suppose this is what you want:


THANK YOU!
o That's perfect!
https://i.postimg.cc/J0mLXN73/tz02.jpg

I'm no programmer where I had been struggling in vain using the syntax of
":EOF" labels & "goto :EOF" commands to mimic the cat EOF capability.

*Your dozen-line script created 137 timezone-setting files*:
@echo off
rem maketzfile.bat
setlocal enabledelayedexpansion
set t=0
for /f "tokens=*" %%i in ('tzutil /l') do (
set /a t=t+1
set b=!a!
set a=%%i
if !t!==2 (echo REM !b!"!a!.bat"
echo tzutil.exe /s "!a!""!a!.bat"
set t=0))
exit 0

*This dozen-line script randomly executes just _one_ of those 137 files:
@echo off
rem setrandomtz.bat
setlocal EnableDelayedExpansion
cd .\tzfiles
set n=0
for %%f in (*.*) do (
set /a n+=1
set "file[!n!]=%%f"
)
set /a num=%random% %% 137-1
"!file[%num%]!"
exit 0

Now all I have to do is figure out how to run that script at random times.
o How do I schedule a task at a random time via batch file?
https://stackoverflow.com/questions/22941468/how-do-i-schedule-a-task-at-a-random-time-via-batch-file

That random scheduling solution is hairy, but I can run it manually
by making a shortcut whose target runs the random time zone script above:
TARGET = setrandomtz.bat
STARTIN = c:\path\tzfiles
I can use some of the tricks in this tutorial to make GUI access easy:
o Tutorial to get batch command shortcuts working perfectly on Windows
https://groups.google.com/d/msg/microsoft.public.windowsxp.general/1PzeGP4KMTU/tTbcd9zxAAAJ

The only trick left is to figure out how to randomly schedule it to run:
https://ss64.com/nt/schtasks.html

THANK YOU very much Herbert Kleebauer, for helping a fellow Windows user!
(And, by extension, helping everyone who wants a random command executor.)
--
Note being able to run a command at a random time which randomly runs one
of 137 timezone commands is, in a general sense, useful, where, in this
case, the goal is to make browser timezone fingerprinting a bit less
uniquely determinative.
Ads