Win10/64: Batch File To Get Date Broken

Discussion in 'Software' started by HarryPotter, May 21, 2021.

  1. HarryPotter

    HarryPotter MajorGeek

    Hi! I have a batch file to back up my source code and another to get the current date. The latter stopped working. :( Attached is the batch file to get the date. Any ideas on what's wrong?
     

    Attached Files:

  2. _nullptr

    _nullptr Major Geeky Geek Geek

    It works fine to get the date.
    Code:
    @echo off
    for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
    set DATE2=%dt:~0,4%-%dt:~4,2%-%dt:~6,2%
    echo %DATE2%
    pause>nul
    
    output: 2021-05-21
    
     
  3. HarryPotter

    HarryPotter MajorGeek

    When I run the file, I get:
    Code:
    C:\MyPrgs\Batch>"Backup Date in DATE2"
    Node - HARRYPOTTER1
    ERROR:
    Description = Invalid class
    
    C:\MyPrgs\Batch>
    
     
  4. _nullptr

    _nullptr Major Geeky Geek Geek

    Last edited: May 21, 2021
  5. HarryPotter

    HarryPotter MajorGeek

    I get the same error. I'll try your suggestion.
     
  6. HarryPotter

    HarryPotter MajorGeek

    I tried downloading the suggested file and got an error message stating that I should disable a firewall. I don't think I have a firewall, but, if I do, how do I add an exception? I have Win10/64 and use Speed Browser, don't know what version.
     
  7. _nullptr

    _nullptr Major Geeky Geek Geek

    Did you try using the manual instructions in that article?
    1] Reset WMI Repository and 2] Force Recover WMI
     
  8. HarryPotter

    HarryPotter MajorGeek

    I read the article. It didn't list my exact problem. :(
     
  9. _nullptr

    _nullptr Major Geeky Geek Geek

    Your error is listed in point 3 - 0x80041010 WBEM_E_INVALID_CLASS
     
  10. HarryPotter

    HarryPotter MajorGeek

    The command on the page tells me "WMI repository is consistent."
     
  11. _nullptr

    _nullptr Major Geeky Geek Geek

    Basically, you're going to have to research the problem yourself and use trial and error. My WMI isn't corrupt or throwing the same error, so I can't really say for certain what will work
    If it was me, I'd try searching https://www.google.com/search?q=win...57j0i22i30.16853j0j4&sourceid=chrome&ie=UTF-8

    If all else failed, I'd do a repair installation - https://www.tenforums.com/tutorials/16397-repair-install-windows-10-place-upgrade.html

    You can get all ISO's including the latest 21H1 at TechBench: https://tb.rg-adguard.net/public.php
     
  12. HarryPotter

    HarryPotter MajorGeek

    I don't want to rebuild everything. Apparently, the problem is with a namespace that belongs to me--the name is HARRYPOTTER1. Is there a way to use a different namespace to get the current date? I can post the batch file on request.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds