Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
If not次のようなコマンドでバッチ ファイルを作成するにはどうすればよいですIF NOT [extension type] Then delete allか?
If not
IF NOT [extension type] Then delete all
forコマンドと変数展開を組み合わせたコマンドifを使用すると、指定した拡張子のファイルを除くすべてのファイルを削除できます。たとえば、これは、現在のディレクトリ内の .TXT 拡張子を持たないすべてのファイルを削除します (大文字と小文字は区別されません)。
for
if
for %%i in (*) do ( if /i "%%~xi" neq ".TXT" del %%i )