DIR - 列出除了一些所有文件夹 [英] dir - List all folders except some

查看:154
本文介绍了DIR - 列出除了一些所有文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让Windows批处理文件,以显示已安装的半条命1 MODS。

安装的MODS有他们自己的文件夹在hl.exe是目录,如 cstrike文件 SvenCoop

但也有在同一目录中是HL1引擎的一部分几个文件夹: gldrv 平台 relists

我想要做一个 DIR 列出所有在该目录中除5个文件夹的是HL1引擎的一部分的文件夹。


解决方案

 关闭@echo
SETLOCAL EnableDelayedExpansion
在/ D %% D(*)做(
    集中展现= YES
    对于一个%%在(斌gldrv平台relists阀)做,如果%% ==Ð%%一套节目=无
    如果!展现! ==是DIR %%ð

I'm trying to make a Windows batch file to show installed Half Life 1 mods.

Installed mods have their own folder in the directory where hl.exe is, eg cstrike or SvenCoop.

But there are also a few folders in that same directory that are part of the hl1 engine: bin, gldrv, platform, relists, and valve.

I'd like to do a dir that lists all the folders in that directory except those 5 folders that are part of the hl1 engine.

解决方案

@echo off
setlocal EnableDelayedExpansion
for /D %%d in (*) do (
    set show=yes
    for %%a in (bin gldrv platform relists valve) do if %%d == %%a set show=no
    if !show! == yes dir %%d
)

这篇关于DIR - 列出除了一些所有文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆