-
March 18th, 2003, 12:52 PM
#1
Registered User
-
March 18th, 2003, 12:58 PM
#2
HERE is a good page that shows how to use DOS variables as well as reading text files. there are also links to some freeware progs that make variable manipulation easier.
-
March 18th, 2003, 12:59 PM
#3
Registered User
try this
try rename instead of ren
i love peta...and sars...
and bin laden....and n. korea....and china...and p2p...spyware...
-
March 18th, 2003, 01:01 PM
#4
Tech-To-Tech Mod
perhaps a small visual basic app.
Nonsense prevails, modesty fails
Grace and virtue turn into stupidity - E. Costello
-
March 18th, 2003, 01:42 PM
#5
Registered User
Re: try this
Originally posted by Chris_MacMahon
try rename instead of ren
REN and RENAME are the same command, but thanks!
DON'T PANIC
-
March 18th, 2003, 01:57 PM
#6
Registered User
on my machine when i type ren balh.bat hlab.bat i get bad command or file name...
when i type rename blah.bat halb.bat it's succesfull
win xp pro
i love peta...and sars...
and bin laden....and n. korea....and china...and p2p...spyware...
-
March 18th, 2003, 02:04 PM
#7
Banned
Originally posted by Chris_MacMahon
on my machine when i type ren balh.bat hlab.bat i get bad command or file name...
when i type rename blah.bat halb.bat it's succesfull
win xp pro
Techleet is correct, both are the exact same command.
-
March 19th, 2003, 02:22 AM
#8
It often helps when using rename operations to change the extension at the same time. eg
ren bob*.txt bob%date%.ttt
ren bob*.ttt bob*.txt
The Batch Masters over at alt.msdos.batch could get you going right off, although the question and answer is no doubt to be found just searching that awesome group.
Batch is _not_ an unstructured language - its a cult
-
March 19th, 2003, 06:23 PM
#9
Junior Member
I don't think the %date% variable will work.
You can't have a forward slash in a file name.
I tried this in a win Xp Dos box
echo %date%
This was the output
Wed 03/19/2003
Try another variable.
Good Luck !
-
March 20th, 2003, 04:19 AM
#10
Driver Terrier
You can, however, change the date separator in Regional and Language options to a period or a dash, the dash should get around it?
Never, ever approach a computer saying or even thinking "I will just do this quickly."
-
March 20th, 2003, 09:06 PM
#11
Registered User
Well this is for Windows 98.
But he has some NT stuff for putting date into the environment variable available here
I've set up a .bat at work under 98 that copies a logfile from one PC to another and renames it to the corresponding date.
It looks something like this...
@echo off
echo.|date|find "Current" >cu##ent.bat
echo set date=%%4> current.bat
call cu##ent.bat
del cu??ent.bat > nul
copy /y \\workstation\share\nightly.txt \\otherpc\logfiles\"%date%-nightly.log"
@echo off
cls
However, I've tried setting this up on a XP machine and an NT 4 machine so that the .bat file runs on the XP machine and copies down to itself however no luck, but I'm no DOShead, maybe you or someone else can shed some light from the above links.
There are alotta good links from that guys site
http://www.ericphelps.com
~good luck
Last edited by craigmodius; March 20th, 2003 at 09:14 PM.
"And just when I thought today couldn't get anymore poo-like." -Outcoded
-
March 21st, 2003, 07:44 PM
#12
Junior Member
SO....
How bout that war.
-
March 21st, 2003, 08:06 PM
#13
Registered User
Originally posted by grief
SO....
How bout that war.
Wow, that was random. Glad I had the Email Notification on.
DON'T PANIC
-
March 21st, 2003, 08:27 PM
#14
Registered User
Originally posted by craigmodius
But he has some NT stuff for putting date into the environment variable available here
YOU ARE A GOD!!!!!
Here's all the code you need:
for /f "tokens=1-4 delims=/ " %%a in ('date /t') do (set weekday=%%a& set day=%%b& set month=%%c& set year=%%d)
set jdate=%day%-%month%-%year%
ren bob.txt bob_%jdate%.txt
Works like a charm!! Thanks!!
DON'T PANIC
-
March 21st, 2003, 09:44 PM
#15
Registered User
"And just when I thought today couldn't get anymore poo-like." -Outcoded
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|
Bookmarks