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 42,539 of 42,547   
   me at to All   
   Moving batch files to a Windows-11 lapto   
   19 Jan 26 14:33:24   
   
   From: my.address@is.invalid   
      
    Good morning,   
      
   Have updated to a new computer running windows 11.   
   The following bat file will not work on it.   
   Lots of googling, there is no longer wmic and that I must use powershell.   
   Looking at many posts on stackoverflow.com I still dont get it.   
   Please write me something I can put in a batch file.   
      
   Sun 01/18/2026 10:14:23 C:\tmp >cpdas aaa.txt   
      
   Sun 01/18/2026 10:14:23 C:\tmp >copy "aaa.txt" "C:\tmp\aaa-20260   
   18-1014-23.txt"   
           1 file(s) copied.   
   Sun 01/18/2026 10:14:23 C:\tmp >   
      
   8<--- old script   
      
     @echo off   
     for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list')   
   do set datetime=%%I   
     set datetime=%datetime:~0,8%-%datetime:~8,4%-%datetime:~12,2%   
     @echo on   
      
     copy "%1" "%~dpn1-%datetime%%~x1"   
      
   --->8   
      
   Thanks,   
      
   --- 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