Search found 6 matches

by dominion
14 Feb 2011 08:55
Forum: DOS Batch Forum
Topic: How to rename a file with date/time?
Replies: 3
Views: 19235

Re: How to rename a file with date/time?

Sorry for disturbance i made mistake.
now it's working well

Code: Select all

ren file.txt file-%date:~0,2%-%date:~3,2%-%date:~6,4%-%time:~0,2%-%time:~3,2%-%time:~6,2%.txt


Thank Dominion and have a nice week.
by dominion
14 Feb 2011 08:52
Forum: DOS Batch Forum
Topic: How to rename a file with date/time?
Replies: 3
Views: 19235

Re: How to rename a file with date/time?

I modify the previous code to:

r

Code: Select all

en file.txt file-%date:~0,2%-%date:~3,2%-%date:~6,4%-%time:~0,2%-%time:~6,2%-%time:~0,2%.txt

but when current is : 15:50:00
the file name is: file-14-02-2011-15-58-00 ?? why?

the time is incorect why?

thank you
by dominion
14 Feb 2011 08:39
Forum: DOS Batch Forum
Topic: How to rename a file with date/time?
Replies: 3
Views: 19235

Re: How to rename a file with date/time?

I found it but:

ren file.txt file%date:~0,2%%date:~3,2%%time:~0,2%%time:~3,2%.txt

i'm looking how to add day and second
thanks
by dominion
14 Feb 2011 08:26
Forum: DOS Batch Forum
Topic: How to rename a file with date/time?
Replies: 3
Views: 19235

How to rename a file with date/time?

Hi,

how is it possible to rename a file with current date and time.
i'm trying this but it's not working.

please help:

Code: Select all

@echo off
color 4
set N=
(for /f "tokens=1-5 delims=:" %%d in ("%time%") do ceho rename
file.txt file%%d-%%e-%%f.txt)


i'm using xp and Win7
pause
by dominion
12 Feb 2011 15:54
Forum: DOS Batch Forum
Topic: how to copy and paste data at the beginning of a file?
Replies: 2
Views: 3122

Re: how to copy and paste data at the beginning of a file?

Hello,

thanks a lot
it's working fine.

Dominion :D
by dominion
12 Feb 2011 13:10
Forum: DOS Batch Forum
Topic: how to copy and paste data at the beginning of a file?
Replies: 2
Views: 3122

how to copy and paste data at the beginning of a file?

Hi i'm trying to extract 10first lines of from a text file and paste it at the beginning of an existing file. i try this code but when it pastes data it just deletes the existing data . how could i modify this code? @echo off & setLocal enableDELAYedeXpansion set N= (for /f "tokens=* delims...