Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows API
  4. parse %date% as text in batch

parse %date% as text in batch

Scheduled Pinned Locked Moved Windows API
help
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    greendragons
    wrote on last edited by
    #1

    Hello, Im trying to write a batch file which creates another batch file..... @echo off echo if %date%==03-10-2009 pause>>D:\hello.bat output is if 02-10-2009==03-10-2009 pause ....................................... the problem is that instead of taking %date% as text it's writing date on hello.bat..... i even tried with ^ @echo off echo if %^date^%==03-10-2009 pause>>D:\hello.bat now in this case the output is if ==03-10-2009 pause but when the same command echo if %^date^%==03-10-2009 pause>>D:\hello.bat i give from cmd instead running bat it's giving correct format in hello.bat if %date%==03-10-2009 pause.... i want this %date% to be printed as it is not as value in hello.bat through a batch file.

    L 1 Reply Last reply
    0
    • G greendragons

      Hello, Im trying to write a batch file which creates another batch file..... @echo off echo if %date%==03-10-2009 pause>>D:\hello.bat output is if 02-10-2009==03-10-2009 pause ....................................... the problem is that instead of taking %date% as text it's writing date on hello.bat..... i even tried with ^ @echo off echo if %^date^%==03-10-2009 pause>>D:\hello.bat now in this case the output is if ==03-10-2009 pause but when the same command echo if %^date^%==03-10-2009 pause>>D:\hello.bat i give from cmd instead running bat it's giving correct format in hello.bat if %date%==03-10-2009 pause.... i want this %date% to be printed as it is not as value in hello.bat through a batch file.

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      did you try escaping your % signs, by doubling them? BTW: do you really think this problem is Vista/Win7 specific? :)

      Luc Pattyn


      Local announcement (Antwerp region): Lange Wapper? Neen!


      G 1 Reply Last reply
      0
      • L Luc Pattyn

        did you try escaping your % signs, by doubling them? BTW: do you really think this problem is Vista/Win7 specific? :)

        Luc Pattyn


        Local announcement (Antwerp region): Lange Wapper? Neen!


        G Offline
        G Offline
        greendragons
        wrote on last edited by
        #3

        Thnx alot i got it :) i didnt use %%date%% instead i was trying ^%date^%.....

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups