Skip to content
朝一起動
software
2019-06-28
# 朝一起動
function runIfNot($name,$cmd,$ag=$null)   {
    if((Get-Process -Name $name -ErrorAction SilentlyContinue) -eq $null)  {
        if($ag -eq $null)	{
            start-process $cmd
        } else {
            start-process $cmd -ArgumentList $ag
        }
    }
}
function jobIfNot($name,$cmd)   {
    if((Get-Process -Name $name -ErrorAction SilentlyContinue) -eq $null)  {
        Start-Job -ScriptBlock {start-process $using:cmd}
    }
}
runIfNot "chrome" "chrome.exe"
runIfNot "firefox" "firefox.exe" "http://radiko.jp/#!/live/FMFUKUOKA"
runIfNot "onenoteim" "onenote-cmd:"
#runIfNot "ONENOTE" "ONENOTE.EXE"
runIfNot "thunderbird" "thunderbird.exe"
jobIfNot "slack" "slack:"
powershell -File "暗号ドライブ起動.ps1"
Start-Sleep -s 30
powershell -File "devウィンドウ整列.ps1"
Start-Sleep -s 60
powershell -File "devメールバックアップ.ps1"
# 朝一起動
function runIfNot($name,$cmd,$ag=$null)   {
    if((Get-Process -Name $name -ErrorAction SilentlyContinue) -eq $null)  {
        if($ag -eq $null)	{
            start-process $cmd
        } else {
            start-process $cmd -ArgumentList $ag
        }
    }
}
function jobIfNot($name,$cmd)   {
    if((Get-Process -Name $name -ErrorAction SilentlyContinue) -eq $null)  {
        Start-Job -ScriptBlock {start-process $using:cmd}
    }
}
runIfNot "chrome" "chrome.exe"
runIfNot "firefox" "firefox.exe" "http://radiko.jp/#!/live/FMFUKUOKA"
runIfNot "onenoteim" "onenote-cmd:"
#runIfNot "ONENOTE" "ONENOTE.EXE"
runIfNot "thunderbird" "thunderbird.exe"
jobIfNot "slack" "slack:"
powershell -File "暗号ドライブ起動.ps1"
Start-Sleep -s 30
powershell -File "devウィンドウ整列.ps1"
Start-Sleep -s 60
powershell -File "devメールバックアップ.ps1"

少し前に勉強がてらに朝定型的に起動させるアプリ類の起動バッチをPowerShellで書いた。こういう小さいところでも思考の判断量を減らすと、気力の維持に役立つというのが最近しみじみ思う。

若い頃は全然大丈夫だったことなので、老いてきているのを痛感するとともに、今のうちにゴリゴリ生活効率化をしておかないと次の半世紀の生活をキープするのが厳しい予感がある。