Set-VMProcessor -VMName -ExposeVirtualizationExtensions $true
使用内部交换机,假设IP为 192.168.137.x
添加NAT,然后重启虚拟机
https://www.vembu.com/blog/hyper-v-virtual-switch-using-nat-setup/
https://charbelnemnom.com/how-to-configure-hyper-v-virtual-switch-that-supports-nat-network-with-powershell-hyperv-powershell/
New-NetNat -Name HyperVNat -InternalIPInterfaceAddressPrefix 192.168.137.0/24
set filepath="C:\some path\having spaces.txt"
for /F "delims=" %%i in (%filepath%) do set dirname="%%~dpi"
for /F "delims=" %%i in (%filepath%) do set filename="%%~nxi"
for /F "delims=" %%i in (%filepath%) do set basename="%%~ni"
ffmpeg -vf 'scale=if(gte(iw,ih),min(1280,iw),-2):if(lt(iw,ih),min(1280,ih),-2)'
dotnet publish -r win-x64 -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true /p:IncludeNativeLibrariesForSelfExtract=true
https://stackoverflow.com/questions/7727114/batch-command-date-and-time-in-file-name
for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do set datetime=%%I
type $env:USERPROFILE\.ssh\id_rsa.pub | ssh {IP-ADDRESS-OR-FQDN} "cat >> .ssh/authorized_keys"
$regKey="HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
Set-ItemProperty -Path $regKey -name ProxyServer -Value "$($server):$($port)"
Set-ItemProperty -Path $regKey -name ProxyEnable -Value 1
param()
function Get-AllRepos ()
{
Get-ChildItem -Recurse -Depth 2 -Force |
Where-Object { $_.Mode -match "h" -and $_.FullName -like "*\.git" } |
ForEach-Object {
$dir = Get-Item (Join-Path $_.FullName "../")
pushd $dir
"Fetching $($dir.Name)"
git pull
popd
}
}
Get-AllRepos
do not use $RegKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP"
use User32.dll function instead, is working
open ms-windows-store://pdp/?ProductId=9n4wgh0z6vhq in browser
Windows 11/10 startup folder location
To open the Windows 11/10 Startup folder:
Open the WinX Menu
Select Run to open the Run box
Type shell:startup and hit Enter to open the Current Users Startup folder
Type shell:common startup and hit Enter to open the All Users Startup folder
; get wim info
C:\Windows\System32 > Dism.exe /get-wiminfo /wimfile:”C:\install.wim”
; mount wim
C:\Windows\System32>Dism /mount-wim /wimfile:”C:\install.wim” /index:3 /MountDir:D:\1
; unmount wim
C:\Windows\System32 > Dism /unmount-wim /MountDir:d:\1 /discard
; PowerShell set http_proxy/https_proxy
; Using context parameters to add a proxy configuration in your PowerShell script
; https://docs.vmware.com/en/VMware-Cloud-Assembly/services/Using-and-Managing/GUID-58652BA4-2254-4B3B-85A9-6662CB01D1F4.html
$proxyString = "http://" + $context.proxy.host + ":" + $context.proxy.port
$Env:HTTP_PROXY = $proxyString
$Env:HTTPS_PROXY = $proxyString
Set-Alias -Name list -Value Get-ChildItem
#windows powershell equal of which
Get-Command ipconfig
Get-Command -CommandType Application
DISM.exe /Online /Cleanup-image /Restorehealth
sfc /scannow
Instead of using the user vimrc file: $HOME_vimrc and user gvimrc file: $HOME_gvimrc I used 2nd user vimrc file: $HOME\vimfiles\vimrc and 2nd user gvimrc file: $HOME\vimfiles\gvimrc
- working: $HOME\vimfiles\vimrc
- not working: $HOME/_vimrc
system vimrc file: "$VIM\vimrc"
user vimrc file: "$HOME\_vimrc"
2nd user vimrc file: "$HOME\vimfiles\vimrc"
3rd user vimrc file: "$VIM\_vimrc"
user exrc file: "$HOME\_exrc"
2nd user exrc file: "$VIM\_exrc"
defaults file: "$VIMRUNTIME\defaults.vim"