home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch      Fun with MS-DOS batch files      42,547 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 41,820 of 42,547   
   Herbert Kleebauer to Arlen Holder   
   Re: Can a Windows batch script perform t   
   14 Apr 20 14:48:53   
   
   XPost: alt.comp.os.windows-10, microsoft.public.windowsxp.general   
   From: klee@unibwm.de   
      
   On 14.04.2020 11:50, Arlen Holder wrote:   
   > 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   
      
   I suppose that is not what you really want.   
      
   >   
   > 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   
      
   I suppose this is what you want:   
      
   @echo off   
   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))   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca