Skip to content

Instantly share code, notes, and snippets.

@bracca95
Last active July 9, 2024 12:33
Show Gist options
  • Select an option

  • Save bracca95/267aee3be05f45dfeff179760d00bee3 to your computer and use it in GitHub Desktop.

Select an option

Save bracca95/267aee3be05f45dfeff179760d00bee3 to your computer and use it in GitHub Desktop.
Some troubleshooting techniques for background processes on Windows

Windows Troubleshooting

Using background processes on windows, especially if connected through ssh, might be painful. Here's a collection of (some of) the problems that I ran into while using Windows.

You can get the amount of available RAM (free equivalent command) by typing:

wmic ComputerSystem get TotalPhysicalMemory

Stop a process

When you start a background process with start (nohup equivalent) you might want to stop it:

:: identify the processes (supposing that python.exe is what you want to locate)
wmic process where "name='python.exe'" get ProcessId,CommandLine

:: kill it with
taskkill /PID <PID> /F

Search and kill a process

There might be situations in which you wanted, for instance, to delete a directory but the OS returns an error complaining that another process is locking the resource. In this case:

  1. Win + R,
  2. type resmon.exe (resource monitor),
  3. start writing the resource you need in the search bar in the middle of the window,
  4. kill all the process that are holdingn the resource.

Remove a folder with its content

rm -rf <dir> equivalent:

rd /s /q <dir>

Copy a folder with its content

cp -r <src_fold> <dst_fold> equivalent is even more absurd:

xcopy <src_dir> <dst_dir> /E /I
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment