netsh interface ipv4 show interface netsh interface ipv6 show interface
netsh 見やすい
netsh interface ipv4 show route netsh interface ipv6 show route
route 打ちやすい、絞り込みができる
route print route print -4 route print -6 route print 192.168.*
netsh interface ipv4 add route prefix=203.0.113.0/24 interface="(INTERFACE_NAME)" netsh interface ipv4 delete route prefix=203.0.113.0/24 interface="(INTERFACE_NAME)"
個人的に route add よりこっちのほうが使いやすい
netsh interface ipv4 set interface interface="(INTERFACE_NAME)" metric=1000
rasphone /d (CONNECTION_NAME)
切断
rasphone /h (CONNECTION_NAME)
VpnClient Module | Microsoft Learn
https://learn.microsoft.com/en-us/powershell/module/vpnclient
接続の追加
Add-VpnConnection -Name "your connection" -ServerAddress gateway.contoso.com -TunnelType l2tp -RememberCredential -SplitTunneling -PassThru -L2tpPsk "do not save your psk with cmd history"
接続先エンドポイントの変更
Set-VpnConnection -Name "your connection" -ServerAddress gateway2.contoso.com -PassThru
DNS 接尾辞の設定
Set-VpnConnection -Name "your connection" -DnsSuffix internal.contoso.com -PassThru
Per user
explorer %AppData%\Microsoft\Network\Connections
code %AppData%\Microsoft\Network\Connections\Pbk\rasphone.pbk
All users
explorer %ProgramData%\Microsoft\Network\Connections
code %ProgramData%\Microsoft\Network\Connections\Pbk\rasphone.pbk
[MS-RRASM]: Phonebook entry settings | Microsoft Learn
https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rrasm/8c981154-725c-47a3-84c6-db2be962fdde
上記に説明が載ってないもので個人的によくいじる/いじりそうなもの:
Add-VPNConnectionRoute "your connection" -DestinationPrefix 203.0.113.0/24追加された経路は
(Get-VPNConnection "your connection").routesで確認できる。
Set-VpnConnectionTriggerDnsConfiguration -Name "your connection" -DnsSuffixSearchList "foo.example.com", "boo.example.com"追加済みの接尾辞リストの確認
Get-VpnConnectionTrigger -Name "your connection" |% DnsSuffixSearchList
net start MSSQLSERVER
net stop MSSQLSERVER
net stop /y MSSQLSERVER & net start /y SQLSERVERAGENT
依存するサービスの同時起動・停止を /y オプションで許可する。
起動時は SQLSERVERAGENT が MSSQLSERVER に依存することを利用して MSSQLSERVER を起動する。
個人的によく使うもの
そのほかは:
【Windows10】コントロールパネルのアイテムをコマンド起動 - SEブログ
https://soma-engineering.com/desktop/windows10/command-items-controlpanel/2018/09/09/
ncpa.cpl
control /name Microsoft.NetworkAndSharingCenter
wf.msc
control /name Microsoft.CredentialManager
services.msc
taskschd.msc
eventvwr.msc
control /name Microsoft.DevicesAndPrinters
appwiz.cpl
cd "C:\path\" for %i in (*.*) do echo "%~pi%~ni%~xi"
for /r "C:\path\" %i in (*.*) do echo "%~pi%~ni%~xi"
for /r "C:\conv\" %i in (*.wav) do ffmpeg -i "%i" "%~pi%~ni.flac"