得到这个批处理文件名列出文件路径为文件gtr比某个大小..如何修改只列出没有路径和扩展名的文件名?

时间:2015-12-06 19:41:38

标签: batch-file

在批次达到此点之前,将定义

%unit%和%dsize%。可能是这样的:

set "unit=mb"&set "dsize=100"

现在有办法只列出文件名吗?如果可能的话,谁能告诉我它是如何工作的?我不明白" set size =%1"和#34;回声。%~2"部分。怎么"%~2"用路径回显文件名?

for /r %%m in (%ext%) do call :logic %%~zm "%%m"
exit
:logic
set size=%1
if '%unit%'=='bb' set "sizen=%size%"
if '%unit%'=='kb' set "sizen=%size:~0,-3%"
if '%unit%'=='mb' set "sizen=%size:~0,-6%"
if not defined sizen set sizen=0
if %sizen% gtr %dsize% echo.%~2>> temp.txt&cls
exit /b

1 个答案:

答案 0 :(得分:0)

package  {

    import flash.net.SharedObject;
    import flash.display.DisplayObject;

    public class gestioneMultilingua 
    {
        public static function settaLingua(lingua:String):void
        {
            var dati:SharedObject = SharedObject.getLocal("datiApp", "/");
            dati.data.lingua = lingua;
            dati.flush();
        }

        public static function applicaFiltriLingua():void 
        {
            var dati:SharedObject = SharedObject.getLocal("datiApp", "/");
            var lingua : String = dati.data.lingua;

            for(var i:int = 0; i<numChildren; i++){
                var e:Object = getChildAt(i);

                if(e.name.indexOf("$"+lingua) >= 0){
                    e.visible = true;
                }
                else if(e.name.indexOf("$")  >= 0){
                    e.visible = false;
                }
            }
        }
    }
}

以下是您的选择(在示例中替换我的xxx)

for /r %%i in (*.*) do (
echo %%~xxx )

可以组合修饰符以获得复合结果:

%~I         - expands %I removing any surrounding quotes (")
%~fI        - expands %I to a fully qualified path name
%~dI        - expands %I to a drive letter only
%~pI        - expands %I to a path only
%~nI        - expands %I to a file name only
%~xI        - expands %I to a file extension only
%~sI        - expanded path contains short names only
%~aI        - expands %I to file attributes of file
%~tI        - expands %I to date/time of file
%~zI        - expands %I to size of file
%~$PATH:I   - searches the directories listed in the PATH
               environment variable and expands %I to the
               fully qualified name of the first one found.
               If the environment variable name is not
               defined or the file is not found by the
               search, then this modifier expands to the
               empty string

在上面的示例中,%I和PATH可以替换为其他有效的 值。 %〜语法由有效的FOR变量名终止。 选择大写变量名称(如%I)使其更具可读性 避免与修饰符混淆,修饰符不区分大小写。