מאת:מרטין שוורצמן
כמעט שאין קורס או הרצאה שאני מעביר על PowerShell שאני לא נשאל בה: 'איך אפשר לראות עברית ב – shell?'
קודם כל צריך להגדיר פונט ב – console שמכיל תווים בעברית.
הפונט צריך להיות fixed, כלומר כל תו תופס את אותו גודל על המסך. לכן בחרתי ב – Courier New. את Courier New צריך להגדיר ב – Registry כפונט שזמין ב – Console, על ידי הוספת ערך תחת ה – Key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont
אם כבר קיימים שם ערכים עם אפסים (0), צריך להוסיף ערך חדש בעל כמות אפסים גדולה יותר.
כברירת מחדל, יש שם שני ערכים עם שמות בעלי אפסים. אחד עם אפס אחד של פונט ה – Lucida Console
והשני, עם שני אפסים של פונט ה – Consolas
לכן יש להוסיף ערך בשם 000, עם המידע "Courier New"
אחרי זה, ניתן לבחור אותו כפונט שבשימוש ה – PowerShell console
שימו לב להגדיר כך שיהיה בגודל של 20 לפחות,
שזה אומר 20 פיקסלים לגובה, ו – 10 לרוחב.
ואם רוצים לעשות את הכל באופן אוטומטי… PowerShell בכל זאת, לא?
# Change location to the registry path:
cd 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont'
# Add the registry value for the 'Courier New' font:
Set-ItemProperty -Path . -Name 000 -Value 'Courier New'
# Create a new PSDrive to load the HKEY_USERS hive:
New-PSDrive HKU Registry HKEY_USERS
# Change location to the user's registry:
cd HKU:
cd (New-Object System.Security.Principal.NTAccount($env:USERNAME)).Translate([System.Security.Principal.SecurityIdentifier]).Value
# Set the console font name and size:
Set-ItemProperty -Path 'Console\%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe' -Name FaceName -Value 'Courier New'
Set-ItemProperty -Path 'Console\%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe' -Name FontSize -Value 1310720
Set-ItemProperty -Path 'Console\%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe' -Name FontWeight -Value 400
# Clean up..
cd c:\
Remove-PSDrive HKU
בהצלחה!
מרטין.
מרטין שוורצמן הינו מהנדס בכיר בתחום ה Platforms בקבוצת Premier Field Engineer של מיקרוסופט בישראל. מתמחה באוטומציה ומערכות אינטרנט מבוססות IIS.
תותח… הבטחת.. כתבת… שאפו
ומה לגבי הפיכת הכיוון?
c:\םלוע םולש
וכיו"ב