Need to move TempDB to another drive. But its files cannot be dropped or shrunk
It turns out there are a couple of ways of quickly shrinking or emptying TempDB files and drop them.
The first way.


Change locations and sizes for all TempDB data and log files in system catalogs and restart SQL instance.


ALTER DATABASE tempdb MODIFY FILE(NAME = tempdev, FILENAME = '&lt;file_location&gt;', SIZE = &lt;size&gt;);
ALTER DATABASE tempdb MODIFY FILE(NAME = templog, FILENAME = '&lt;file_location&gt;', SIZE = &lt;size&gt;);

Restart SQL Server instance, drop old TempDB files


And one more way.


Start SQL Server with minimal configuration - using -f parameter and connect via sqlcmd
Delete unneeded files:

ALTER DATABASE tempdb REMOVE FILE [&lt;LogicalFileName&gt;]