Set PC date from a var

Billibong January 31, 2009 at 08:27:14
Specs: Windows XP
Hi,
I'm very real newbee to batch files, does anyone know how to get this to work?
I'm tring to set my PC date by reading a .txt file and setting the PC date. The file currentdate.txt has one line that is captured from the system date variable.

I think it errors when I try to set it because the file has the day of the week (Fri) as part of it.
File Currentdate.txt = Fri 01/30/2009

my batch =

@echo off
Set /P sd=<C:\currentdate.txt
echo %cd% |date


See More: Set PC date from a var

Report •


#1
January 31, 2009 at 09:03:15
What is this trying to do?

echo %cd% |date


=====================================
If at first you don't succeed, you're about average.

M2


Report •

#2
February 2, 2009 at 08:04:41
Mechanix2Go: What is this trying to do?
Probably a misspelling of %sd%. How you manage that on a QWERTY keyboard is beyond me.

Billibong:

for /f "tokens=2" %%a in (Currentdate.txt) do echo %%a | date


Report •

Related Solutions


Ask Question