NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums General General Discussion v
« Previous 1 … 40 41 42 43 44 … 159 Next »
Batch file help

 
  • 0 Vote(s) - 0 Average
Batch file help
imilne
Offline

Posting Freak

Posts: 2,423
Threads: 135
Joined: Feb 2008
#1
2010-03-07, 04:22 PM
Hi all,

Need a little help with a batch file (can be dos or vbs)...

I need a simple if/else statement based on the time of day, ie:

if (earlier than 10am)
[INDENT] do something[/INDENT]
else
[INDENT] do something else[/INDENT]

I know how to do the "do" bit, but I can't suss out the time bit. I'm sure it's very simple, but my googling obviously isn't up to scratch today Rolleyes

Thanks
Graham
Offline

Posting Freak

UK
Posts: 4,058
Threads: 102
Joined: Dec 2005
#2
2010-03-07, 04:31 PM
Pending a more elgant solution ... this creates a variable that I use for a directory name that contains the now date and time ...


Code:
time < return.txt >  dirtxt.txt

for /F  "eol=E tokens=1,2,3,4,5,6,7,8 delims=:" %%i IN (dirtxt.txt) DO set dirname=%%j-%%k-%%l

date < return.txt >  dirtxt.txt

for /F  "eol=E tokens=1,2,3,4,5,6,7,8 delims=:/" %%i IN (dirtxt.txt) DO set dirname=%%j-%%k-%%l%dirname%

The return.txt file contains a carriage return (entered using Alt and the numeric keypad) that may be unnecessary now that the date command supports a /t switch.
speising
Offline

Member

Posts: 57
Threads: 9
Joined: Nov 2008
#3
2010-03-07, 07:12 PM
try it with
Code:
if "%TIME%" LEQ "10:00 AM"

that works for 24 hour time format, don't know about AM/PM, but since AM is alphabetically less than PM, it should work the same.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Comskip config file spudjg1 0 2,112 2019-08-26, 02:49 PM
Last Post: spudjg1
  TS and PART file? Download/recording tv streams joeijm 5 3,915 2018-03-25, 01:53 AM
Last Post: joeijm
  Not saving in s01e01 file format jeflatt 4 3,102 2015-09-30, 08:26 PM
Last Post: mvallevand
  Replace video file without windows telling apps the original was deleted? ATHiker 0 1,708 2013-11-25, 09:23 PM
Last Post: ATHiker
  get working/batch/file dirs from one line[any dir of it's path too!] pBS 17 12,763 2013-11-05, 12:03 PM
Last Post: pBS
  Need Help With Video File Types bdgbill 8 4,175 2012-12-30, 11:43 PM
Last Post: Reddwarf
  how to make a dvd from ts file fuzzweed 3 2,414 2012-04-04, 03:46 PM
Last Post: Reddwarf
  How much ram req'd to delete swap file? Elmo Putney 10 3,702 2012-01-28, 09:40 PM
Last Post: johnsonx42
  Extracting ADS metadata to a seperate file ACTCMS 8 4,963 2011-10-14, 08:23 PM
Last Post: ACTCMS
  Batch file to run Eventghost on PVRX2.exe start AND close it on PVRX.exe exit? jksmurf 7 4,807 2009-03-16, 12:04 AM
Last Post: HtV

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode