Is there command line options to set Regional Settings

  • Thread starter Thread starter Terry
  • Start date Start date
T

Terry

I want to change the date format in Windows from 11/17/2004 to
11-17-2004, perform a backup (that uses the date format to create a
folder with the current date) and then change it back, using the
command-line.

I wouldn't mind leaving it that way but I have found that certain
programs don't take to the format change very well (Quicken doesn't
allow date changes using + or - when in this format).

Is there a way to do that?

--
Terry

***Reply Note***
Anti-spam measures are included in my email address.
Delete NOSPAM from the email address after clicking Reply.
 
Terry said:
I want to change the date format in Windows from 11/17/2004 to
11-17-2004, perform a backup (that uses the date format to create a
folder with the current date) and then change it back, using the
command-line.
Hi

If you have control of the folder name input for the backup, here is
what I would have used:


A combined batch/vbs solution creating a date variable in the
format 11-17-2004 regardless of the regional settings:

--------------------8<----------------------
@echo off
echo D = Now : WScript.Echo Right(100+Month(D),2) ^& "-" ^& _ >%tmp%\today.vbs
echo Right(100+Day(D),2) ^& "-" ^& Year(D) >>%tmp%\today.vbs

for /f "tokens=1" %%a in (
'cscript.exe //Nologo %tmp%\today.vbs') do set today=%%a

del %tmp%\today.vbs
echo Todays date: %today%
--------------------8<----------------------
 
On 11-17-2004 11:47 AM On a whim, Terry pounded out on the keyboard
I want to change the date format in Windows from 11/17/2004 to
11-17-2004, perform a backup (that uses the date format to create a
folder with the current date) and then change it back, using the
command-line.

I wouldn't mind leaving it that way but I have found that certain
programs don't take to the format change very well (Quicken doesn't
allow date changes using + or - when in this format).

Is there a way to do that?

Being the impatient person I am, I decided to find out where in the
registry the setting was stored and exported the key when it was / and
again when it was - (HKCU\Control Panel\International\sDate). Opened the
files and removed all values but the sDate.

Then I used "regedit /s dateseparatordash.reg" as the first line in the
batch to change the format to 11-17-2004, then used "set
date=%date:~-10%" so the date would be shortened to 10 characters (for
creating the daily backup folder), ran xcopy to copy what I needed into
that folder and returned the date format back using "regedit /s
dateseparatorslash.reg" which changes the format back to 11/17/2004.

If there is a command line though, I rather use that.

--
Terry

***Reply Note***
Anti-spam measures are included in my email address.
Delete NOSPAM from the email address after clicking Reply.
 
On 11/17/2004 12:09 PM On a whim, Torgeir Bakken (MVP) pounded out on
the keyboard
Terry wrote:



Hi

If you have control of the folder name input for the backup, here is
what I would have used:


A combined batch/vbs solution creating a date variable in the
format 11-17-2004 regardless of the regional settings:

--------------------8<----------------------
@echo off
echo D = Now : WScript.Echo Right(100+Month(D),2) ^& "-" ^& _ >%tmp%\today.vbs
echo Right(100+Day(D),2) ^& "-" ^& Year(D) >>%tmp%\today.vbs

for /f "tokens=1" %%a in (
'cscript.exe //Nologo %tmp%\today.vbs') do set today=%%a

del %tmp%\today.vbs
echo Todays date: %today%
--------------------8<----------------------

Thanks for the reply. Prior to your post, I had exported registry keys
to do what I needed, but your script is quick and simple. I also found a
little program, date2fd.exe at
http://home.freeuk.net/foxy2k/sft/date2fd.htm that does the same thing.


--
Terry

***Reply Note***
Anti-spam measures are included in my email address.
Delete NOSPAM from the email address after clicking Reply.
 
Back
Top