Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
create *.txt
Name: Dosnotes Date: June 24, 2009 at 20:22:41 Pacific OS: Windows XP Subcategory: Batch
Comment:
Im wanting to create a blank *.txt document named as ddmmyy.txt in the folder E:\Day notes though am unsure if this is possible via dos scripting?
Name: Valerie (by Garibaldi) Date: June 25, 2009 at 01:49:12 Pacific
Reply:
It's a PITD extracting ddmmyy information using a batch script without knowing your date format. Below is a script using both VBS and Batch which will extract the info regardless of date format. By "blank *.txt document" I assume you refer to a 0 (zero) byte file.
:: Code begins...
@echo off
cls
setlocal
set newfile=%temp%\date.vbs
(
echo otherdate = (Date(^)^)
echo yy = datePart("yyyy", otherdate^)
echo mm = datePart("m" , otherdate^)
echo dd = datePart("d" , otherdate^)
echo wscript.echo yy^&" "^&mm^&" "^&dd
)>>%newfile%
FOR /F "tokens=1-3" %%A in ('cscript //nologo %newfile%') do (
set year=%%A
set month=%%B
set day=%%C
)
set year=%year:~-2%
del %newfile%
if %month% lss 10 set month=0%month%
if %day% lss 10 set day=0%day%
if not exist "e:\day notes\" md "e:\day notes\"
echo on>"E:\day notes\%day%%month%%year%.txt"
:: Code ends...
Summary: hi. first of all I'll say I'm completely ignorant at programming and stuff.. but I'm trying to do a tiny batch file to help me with my music collection. So, what I want is to create a text file with t...
Summary: I am creating text files that consist of a single line of data. But once the file is complete, there is an extra "Blank" line. Is there any way to get rid of this extra blank line?? Code: Function Exp...
Summary: I Was wonderering if it was possible that through a batch you could save your information in a .TXT File so you give information and when you exit the batch file it saves it in to a .TXT file or in a ...