A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Microsoft Windows XP » General XP issues or comments
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Can a Windows batch script perform the equivalent of a cat until the end of file delimiter (cat foo eof)?



 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old April 14th 20, 10:50 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)?

Is this common Linux sequence utilizing an EOF label possible in Windows?
cat "foo1.bat" EOF
command 1 to go into the batch file
command 2 to go into the batch file
EOF

cat "foo2.bat" EOF
command 3 to go into the batch file
command 4 to go into the batch file
EOF

For an instantly understandable example of "why" you might want this,
consider the Windows timezone utility being used to create 137 unique batch
files named to Windows time-zone standards, as defined by:
tzutil.exe /l list-of-time-zone-commands.txt
Such that those 137 batch files can be used to randomize the system clock
(e.g., to forestall browser fingerprinting based on time-zone id bits).
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/tzutil

Clarifying (for only 2 of those 137 batch files) the goal would be to
utilize the EOF tag similar to how it would be used below:
cat "Eastern Standard Time.bat" EOF
REM (UTC-05:00) Eastern Time (US & Canada)
tzutil.exe /s "Eastern Standard Time"
EOF

cat "Pacific Standard Time.bat" EOF
REM (UTC-08:00) Pacific Time (US & Canada)
tzutil.exe /s "Pacific Standard Time"
EOF

Note: For WindowsXP, the "tzutil" command is substituted by something like:
runDLL32.exe shell32.dll,Control_RunDLL timedate.cpl,,/Z (GMT-5:00) Eastern
runDLL32.exe shell32.dll,Control_RunDLL timedate.cpl,,/Z (GMT-8:00) Pacific

Windows commands that could create the 137 tz randomizer files are many:
https://www.computerhope.com/issues/ch001676.htm
http://www.trytoprogram.com/batch-file-commands/
https://www.robvanderwoude.com/batchcommands.php
etc.

*But how can we tell Windows batch files to stop output at the EOF tag?*
--
Usenet is a place for adults to gather to politely discuss solutions.


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off






All times are GMT +1. The time now is 08:47 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 PCbanter.
The comments are property of their posters.