Change OS Language Silently (Windows 7) - powershell

I'm writing a script (powershell) for SQL Server 2014 Express Install.
The problem is: I have to change the OS Language (Region and languages) to fr_FR (French from France) Silently. The current language is fr_CA (French from Canada).
My question is: Can i change the language from intl.cpl (Region and languages) with a batch file or command line or just from the register?
Thank you

This could be as simple as one line command in PowerShell
Set-ItemProperty 'HKCU:\Control Panel\Desktop' -Name "PreferredUILanguages" -Value 'fr-FR'
Alternatively you could use a .reg file, or batch file calling reg.exe like this
reg add "HKCU:\Control Panel\Desktop" /f /v "PreferredUILanguages" /t REG_SZ /d 'fr-FR'
Ref: Change OS Language using PowerShell

didn't work for me but i found a solution to my problem.
I use a XML file to change properties by executing :
control.exe intl.cpl,,/f:"c:\Unattend.xml"
in CMD.exe as Admin
Here is my XML file :
<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">
<gs:UserList>
<gs:User UserID="Current"/>
</gs:UserList>
<!-- user locale -->
<gs:UserLocale>
<gs:Locale Name="fr-FR" SetAsCurrent="true" ResetAllSettings="false">
</gs:Locale>
</gs:UserLocale>
</gs:GlobalizationServices>
Thanks for helping

To change windows 7 language
Open the Control Panel.
Snap the "View by" menu and select "Huge symbols" or "Little symbols".
Select Windows Update.
Snap the "# discretionary updates are accessible" interface
Check the container for the language you need to download.
Snap the. Install refreshes.
Come back to the Control Panel and select "District and Language".
Select the language you just introduced from the "Pick a presentation language" drop-down menu.
Snap.Apply
Change your framework area if the language isn't showing in certain projects.
You can also visit
[url=https://www.morphigo.com/]https://www.morphigo.com/[/url]

Related

In Visual Studio 2012 (C#) How to Create Custom Macros available in Post Build

I want to add in a Post-build event commandline in my Visual Studio 2012 C# project.
I have a number of projects in my solution and I would like to add to the list of macros available with "Macros>>".
How can I achieve this?
For instance I have the command line:
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\signtool.exe" sign /f MYPFXFILEPATH /p MYPASSWORD /t http://timestamp.verisign.com/scripts/timstamp.dll $(TargetDir)$(TargetFileName)
I would hate to copy and paste that into every project. I would like to place the first part into a macro so that I would have:
$(SignCommandLinePrefix) $(TargetDir)$(TargetFileName)
Though you won't see your macro in the Macros>> list, you can edit your .csproj file by hand. Look for the first <PropertyGroup> and add this right before the closing </PropertyGroup>:
<SignCommandLinePrefix>"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\signtool.exe" sign /f MYPFXFILEPATH /p MYPASSWORD /t http://timestamp.verisign.com/scripts/timstamp.dll</SignCommandLinePrefix>
Now, you can add $(SignCommandLinePrefix) $(TargetDir)$(TargetFileName) to your Post-Build Event and it will work just as you wish.
Check out Chuck England's response to this question:
http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/e774f871-8fc2-4875-b791-1df3dd0bb2dc/

Access "Start up" folder from CMD?

How can I get the path of the start up folder from a batch file? The only way I found was to look in the registry but I don't think thats possible with CMD.
This will set STARTUP to the location of the startup folder:
for /F "skip=4 tokens=3*" %%j in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Common Startup"') do set STARTUP=%%k
(skip=4 is for XP, use skip=2 for Windows 7. I don't have vista to try the command there)
Also available (change the value after /v)
Common AppData
Common Programs
Common Documents
Common Desktop
Common Start Menu
CommonPictures
CommonMusic
CommonVideo
Common Templates
Common Favorites
Common Startup
Common Administrative Tools
In windows xp you can access like this
importedCountToMainTable
CD %HOMEDRIVE%%HOMEPATH%\Start Menu\Programs\Startup

Pass clipboard to batch in Windows XP

Using Windows XP I want to copy text (URL) to the clipboard and then run a batch file that will use that URL.
I know the reverse is possible with the clip.exe floating around.
I use my own CLIPTEXT program. It is a very simple 5-lines pascal, here is the source code. I am sure that you can get the idea and translate it to any other language.
program cliptext;
uses clipbrd;
begin
writeln(clipboard.asText);
end.
then, in your batch files, you may use to start the copied URLs.
for /f "tokens=*" %%c in ('cliptext') do start "" "%%c"

Is there a Windows command shell that will display Unicode characters?

Assuming I have fonts installed which have the appropriate glyphs in them, is there a command shell for Windows XP that will display Unicode characters? At a minimum, two things that should display Unicode correctly:
Directory listings. I don't care what I have to type (dir, ls, get-childitem, etc.), so long as files with Unicode characters in their names appear with the right glyphs, not the unprintable character box.
Text file content listings. Again, doesn't matter to me if it's 'less', 'more', 'cat', 'dog', etc., so long as the characters are printed. I recognize that this is more complicated because of character encoding of the file, so if I have to specify that on the command line that's fine with me.
Here's what I've tried so far:
cmd.exe
Windows PowerShell; including the multilingual version.
Cygwin bash
No luck. I even tried installing custom fonts for cmd/PowerShell. PowerShell and cmd.exe seem to be Unicode-aware in the sense that I can copy/paste the non-printable box out of there and it will paste into other apps with the correct characters. Cygwin (?) seems to convert to the ? character and that comes through in the copy/paste.
Any ideas?
To do this with cmd.exe, you'll need to use the console properties dialog to switch to a Unicode TrueType font.
Then use these commands:
CHCP 65001
DIR > UTF8.TXT
TYPE UTF8.TXT
Commands:
Switch console to UTF-8 (65001)
Redirect output of DIR to UTF8.TXT
Dump UTF-8 to console
The characters will still need to be supported by the font to display properly on the console.
I18N: Unicode at the Windows command prompt (C++; .Net; Java)
This was a major issue in PowerShell v1. Version 2 is shipping with a "graphical shell" that corrects the problem, which is ultimately not with PowerShell, but with the Windows console host (which Cmd.exe also uses). You can get the current CTP for PowerShell v2, if you want.
Actually, PowerShell v2.0 was finalized and shipped with the release of Windows 7 and Windows Server 2008 R2 in early August. In addition, the backported versions (Windows Vista/2008) reached their Release Candidate milestone just the other day; Windows XP/Windows Server 2003 should follow very shortly. Linky linky.
Setting the codepage to UTF-8 with the command "chcp 65001" should help you print file contents correctly to the shell (using cmd.exe). This won't work for directory listings though (UTF-16 encoding in NTFS file names).
Try this:
powershell.exe -NoExit /c "chcp.com 65001"
Who uses msysgit:
powershell.exe -NoExit /c "chcp.com 65001; sh --login -i"
Do not forget to change font of window to TrueType font with UTF-8 support ("Lucida Console")
This is how I can got Chinese output in cmd.exe running on Windows 7 Pro English Version. I also tried file names with Japanese, Russian, and Polish and they all seem to display correctly. Input also seems to work, at least when I tried to do a dir xxx* containing non-ascii characters.
Install console2, which is a front-end to cmd.exe (and other shells)
After installation, follow these instructions
Delete the key HKEY_CURRENT_USER\Console\Console2 command window in the registry.
Import the following data into windows registry:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console\Console2 command window]
"CodePage"=dword:000003a8
"FontSize"=dword:000a0000
"FontFamily"=dword:00000036
"FontWeight"=dword:00000190
"FaceName"="細明體"
"HistoryNoDup"=dword:00000000
You may or may not have to change the font. Initially I had the font set to #NimSum, and the Chinese characters came out rotated 90 degrees. Then I switched to NimSum (without the #) and it came out correctly. Then just out of curiosity I switched to Consola and yet I can still see the Chinese characters. So I'm not sure if you actually have to set the font or not.
For a true shell, try PowerShell Plus. You can select Unicode fonts and work with other languages, not only in the editor, but in the true console.
Try Console 2. Be careful with the colors/palette configurations though. Those are a bit buggy. I have confirmed them to not work; they behave like cmd.exe.
Open an elevated command prompt (run cmd as administrator). Query your registry for available TrueType fonts to the console by:
REG query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont"
You'll see an output like:
0 REG_SZ Lucida Console
00 REG_SZ Consolas
936 REG_SZ *新宋体
932 REG_SZ *MS ゴシック
Now we need to add a TrueType font that supports the characters you need like Courier New, we do this by adding zeros to the string name, so in this case the next one would be "000" :
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont" /v 000 /t REG_SZ /d "Courier New"
Now we implement UTF-8 support:
REG ADD HKCU\Console /v CodePage /t REG_DWORD /d 65001 /f
Set default font to "Courier New":
REG ADD HKCU\Console /v FaceName /t REG_SZ /d "Courier New" /f
Set font size to 20 :
REG ADD HKCU\Console /v FontSize /t REG_DWORD /d 20 /f
Enable quick edit if you like :
REG ADD HKCU\Console /v QuickEdit /t REG_DWORD /d 1 /f
As of November 2011, MinTTY is now Cygwin's default terminal emulator (installed by setup.exe). MinTTY is a fork of PuTTY's terminal emulator, and as such sports proper Unicode support and much-improved compatibility with other terminal emulators.
PowerShell V2 CTP3 inside Console2 seems to do that. The only downside is that the default console encoding is UCS-2 LE instead of UTF-8.
Also from
UTF-16 on cmd.exe
Open/run cmd.exe
Click on the icon at the top-left corner
Select properties
Then "Font" bar
Select "Lucida Console" and OK.
Write Chcp 10000 at the prompt
Finally dir /b
A fast and convenient way to do it is on the Explorer.
1. Open the Explorer window.
2. Traverse to the top level of directory where you want to find.
3. On the upper right corner, there is a find field.

Tool for commandline "bookmarks" on windows?

Im searching a tool which allows me to specify some folders as "bookmarks" and than access them on the commandline (on Windows XP) via a keyword. Something like:
C:\> go home
D:\profiles\user\home\> go svn-project1
D:\projects\project1\svn\branch\src\>
I'm currently using a bunch of batch files, but editing them by hand is a daunting task. On Linux there is cdargs or shell bookmarks but I haven't found something on windows.
Thanks for the Powershell suggestion, but I'm not allowed to install it on my box at work, so it should be a "classic" cmd.exe solution.
What you are looking for is called DOSKEY
You can use the doskey command to create macros in the command interpreter. For example:
doskey mcd=mkdir "$*"$Tpushd "$*"
creates a new command "mcd" that creates a new directory and then changes to that directory (I prefer "pushd" to "cd" in this case because it lets me use "popd" later to go back to where I was before)
The $* will be replaced with the remainder of the command line after the macro, and the $T is used to delimit the two different commands that I want to evaluate. If I typed:
mcd foo/bar
at the command line, it would be equivalent to:
mkdir "foo/bar"&pushd "foo/bar"
The next step is to create a file that contains a set of macros which you can then import by using the /macrofile switch. I have a file (c:\tools\doskey.macros) which defines the commands that I regularly use. Each macro should be specified on a line with the same syntax as above.
But you don't want to have to manually import your macros every time you launch a new command interpreter, to make it happen automatically, just open up the registry key
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun and set the value to be doskey /macrofile "c:\tools\doskey.macro". Doing this will make sure that your macros are automatically predefined every time you start a new interpreter.
Extra thoughts:
- If you want to do other things in AutoRun (like set environment parameters), you can delimit the commands with the ampersand. Mine looks like: set root=c:\SomeDir&doskey /macrofile "c:\tools\doskey.macros"
- If you prefer that your AutoRun settings be set per-user, you can use the HKCU node instead of HKLM.
- You can also use doskey to control things like the size of the command history.
- I like to end all of my navigation macros with \$* so that I can chain things together
- Be careful to add quotes as appropriate in your macros if you want to be able to handle paths with spaces in them.
I was looking for this exact functionality, for simple cases. Couldn't find a solution, so I made one myself:
#ECHO OFF
REM Source found on https://github.com/DieterDePaepe/windows-scripts
REM Please share any improvements made!
REM Folder where all links will end up
set WARP_REPO=%USERPROFILE%\.warp
IF [%1]==[/?] GOTO :help
IF [%1]==[--help] GOTO :help
IF [%1]==[/create] GOTO :create
IF [%1]==[/remove] GOTO :remove
IF [%1]==[/list] GOTO :list
set /p WARP_DIR=<%WARP_REPO%\%1
cd %WARP_DIR%
GOTO :end
:create
IF [%2]==[] (
ECHO Missing name for bookmark
GOTO :EOF
)
if not exist %WARP_REPO%\NUL mkdir %WARP_REPO%
ECHO %cd% > %WARP_REPO%\%2
ECHO Created bookmark "%2"
GOTO :end
:list
dir %WARP_REPO% /B
GOTO :end
:remove
IF [%2]==[] (
ECHO Missing name for bookmark
GOTO :EOF
)
if not exist %WARP_REPO%\%2 (
ECHO Bookmark does not exist: %2
GOTO :EOF
)
del %WARP_REPO%\%2
GOTO :end
:help
ECHO Create or navigate to folder bookmarks.
ECHO.
ECHO warp /? Display this help
ECHO warp [bookmark] Navigate to existing bookmark
ECHO warp /remove [bookmark] Remove an existing bookmark
ECHO warp /create [bookmark] Navigate to existing bookmark
ECHO warp /list List existing bookmarks
ECHO.
:end
You can list, create and delete bookmarks. The bookmarks are stored in text files in a folder in your user directory.
Usage (copied from current version):
A folder bookmarker for use in the terminal.
c:\Temp>warp /create temp # Create a new bookmark
Created bookmark "temp"
c:\Temp>cd c:\Users\Public # Go somewhere else
c:\Users\Public>warp temp # Go to the stored bookmark
c:\Temp>
Every warp uses a pushd command, so you can trace back your steps using popd.
c:\Users\Public>warp temp
c:\Temp>popd
c:\Users\Public>
Open a folder of a bookmark in explorer using warp /window <bookmark>.
List all available options using warp /?.
With just a Batch file, try this... (save as filename "go.bat")
#echo off
set BookMarkFolder=c:\data\cline\bookmarks\
if exist %BookMarkFolder%%1.lnk start %BookMarkFolder%%1.lnk
if exist %BookMarkFolder%%1.bat start %BookMarkFolder%%1.bat
if exist %BookMarkFolder%%1.vbs start %BookMarkFolder%%1.vbs
if exist %BookMarkFolder%%1.URL start %BookMarkFolder%%1.URL
Any shortcuts, batch files, VBS Scripts or Internet shortcuts you put in your bookmark folder (in this case "c:\data\cline\bookmarks\" can then be opened / accessed by typing "go bookmarkname"
e.g. I have a bookmark called "stack.url". Typing go stack takes me straight to this page.
You may also want to investigate Launchy
With PowerShell you could add the folders as variables in your profile.ps1 file, like:
$vids="C:\Users\mabster\Videos"
Then, like Unix, you can just refer to the variables in your commands:
cd $vids
Having a list of variable assignments in the one ps1 file is probably easier than maintaining separate batch files.
Another alternative approach you may want to consider could be to have a folder that contains symlinks to each of your projects or frequently-used directories. So you can do something like
cd \go\svn-project-1
cd \go\my-douments
Symlinks can be made on a NTFS disk using the Junction tool
Without Powershell you can do it like this:
C:\>set DOOMED=c:\windows
C:\>cd %DOOMED%
C:\WINDOWS>
Crono wrote:
Are Environment variables defined via "set" not meant for the current session only? Can I persist them?
They are set for the current process, and by default inherited by any process that it creates. They are not persisted to the registry. Their scope can be limited in cmd scripts with "setlocal" (and "endlocal").
Environment variables?
set home=D:\profiles\user\home
set svn-project1=D:\projects\project1\svn\branch\src
cd %home%
On Unix I use this along with popd/pushd/cd - all the time.