This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
fuss:dos [2017/02/22 18:30] – external edit 127.0.0.1 | fuss:dos [2023/12/16 03:33] (current) – [Reload / Refresh Environment Variables] office | ||
---|---|---|---|
Line 21: | Line 21: | ||
del PATH /A:H /S | del PATH /A:H /S | ||
</ | </ | ||
+ | |||
+ | ====== Blank the Screen from Command Line ====== | ||
+ | |||
+ | The command: | ||
+ | <code dos> | ||
+ | ping -n 6 127.0.0.1 > nul && explorer C: | ||
+ | </ | ||
+ | |||
+ | will blank the screen in '' | ||
+ | |||
+ | Note that '' | ||
+ | |||
+ | ====== Reload / Refresh Environment Variables ====== | ||
+ | |||
+ | The following script from chocolatey reloads the environment variables on Windows. | ||
+ | <code dos> | ||
+ | @echo off | ||
+ | :: | ||
+ | :: RefreshEnv.cmd | ||
+ | :: | ||
+ | :: Batch file to read environment variables from registry and | ||
+ | :: set session variables to these values. | ||
+ | :: | ||
+ | :: With this batch file, there should be no need to reload command | ||
+ | :: environment every time you want environment changes to propagate | ||
+ | |||
+ | ::echo " | ||
+ | echo | set /p dummy=" | ||
+ | |||
+ | goto main | ||
+ | |||
+ | :: Set one environment variable from registry key | ||
+ | :SetFromReg | ||
+ | " | ||
+ | for /f " | ||
+ | echo/set " | ||
+ | ) | ||
+ | goto :EOF | ||
+ | |||
+ | :: Get a list of environment variables from registry | ||
+ | :GetRegEnv | ||
+ | " | ||
+ | for /f " | ||
+ | if /I not " | ||
+ | call :SetFromReg " | ||
+ | ) | ||
+ | ) | ||
+ | goto :EOF | ||
+ | |||
+ | :main | ||
+ | echo/@echo off >" | ||
+ | |||
+ | :: Slowly generating final file | ||
+ | call :GetRegEnv " | ||
+ | call :GetRegEnv " | ||
+ | |||
+ | :: Special handling for PATH - mix both User and System | ||
+ | call :SetFromReg " | ||
+ | call :SetFromReg " | ||
+ | |||
+ | :: Caution: do not insert space-chars before >> redirection sign | ||
+ | echo/set " | ||
+ | |||
+ | :: Cleanup | ||
+ | del /f /q " | ||
+ | del /f /q " | ||
+ | |||
+ | :: capture user / architecture | ||
+ | SET " | ||
+ | SET " | ||
+ | |||
+ | :: Set these variables | ||
+ | call " | ||
+ | |||
+ | :: Cleanup | ||
+ | del /f /q " | ||
+ | |||
+ | :: reset user / architecture | ||
+ | SET " | ||
+ | SET " | ||
+ | |||
+ | echo | set /p dummy=" | ||
+ | echo . | ||
+ | </ | ||
+ | |||
+ | ====== Kill all Processes ====== | ||
+ | |||
+ | In order to batch-kill multiple instances of the same process, the '' | ||
+ | < | ||
+ | taskkill /IM firefox.exe /F | ||
+ | </ | ||
+ | where: | ||
+ | * ''/ | ||
+ | * ''/ | ||
+ | |||
+ | The command can be useful after a long session of various programs that tend to crash and do not remove themselves from the process list. Typically, this includes browsers like Chrome or Firefox that launch one instance of the browser per tab due to isolation and then end up crashing such that killing each and every single process from the task manager would be inconvenient. | ||
+ | |||