|
|
![]() |
|
|
Top | #1 |
|
OSNN Junior Addict
Joined: February 2006
Posts: 14
Reputation: 10
Power: 50 |
This BATCH file works (I have only copied the upper part of the BATCH file), but only if there are 2 digits in the hour. If there is only one digit in the hour (eg 07:12) it fails because it puts a gap where the o' should be. How can I get the script to enter a two digit hour by default (eg '07') or alternatively handle the gap.
@echo off for /F "usebackq tokens=1 delims=/ " %%i in ('%DATE%') do set day=%%i for /F "usebackq tokens=2 delims=/ " %%i in ('%DATE%') do set month=%%i for /F "usebackq tokens=3 delims=/ " %%i in ('%DATE%') do set year=%%i for /F "usebackq tokens=1 delims=:" %%i in ('%TIME%') do set hour=%%i for /F "usebackq tokens=2 delims=:" %%i in ('%TIME%') do set minute=%%i set Date_Dir=%year%%month%%day%-%hour%%minute% echo Exporting to %Date_Dir% direcory if not exist %Date_Dir% mkdir %Date_Dir% |
|
|
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| vbscript or batch file to play audio file for user on startup | Punkrulz | Web Design & Coding | 10 | November 29th, 2006 1:48pm |
| Batch FIle PLEASE HELP | arew264 | Windows Desktop Systems | 6 | February 24th, 2005 12:56am |
| Batch File Q | omg its nlm | Web Design & Coding | 4 | March 10th, 2004 1:24am |
| Batch File Help | the_tazinator | Windows Desktop Systems | 4 | November 21st, 2003 12:12am |
| XP Batch file | RogerPhillis | Windows Desktop Systems | 4 | November 24th, 2002 11:18pm |
![]() |