- /*&cls
- @echo off
- set "netpath=%systemroot%\Microsoft.NET\Framework"
- for /f "delims=" %%a in ('dir /ad /b "%netpath%\v?.*"') do (
- if exist "%netpath%\%%a\csc.exe" (
- set "cscpath=%netpath%\%%a\csc.exe"
- goto :0
- )
- )
- echo;未安装.Net Framework 2.0及其上版本组件或相关程序丢失&pause&exit
- :0
- "%cscpath%" /out:"%tmp%\$Expdir.exe" "%~f0"
- dir /a-d /b *.txt|%tmp%\$Expdir.exe
- pause&exit
- */
- using System;
- using System.IO;
- using System.Collections;
- using System.Runtime.InteropServices;
- class Expdir
- {
- [DllImport("Shlwapi.dll", CharSet = CharSet.Unicode)]
- private static extern int StrCmpLogicalW(string psz1, string psz2);
- static void Main(string[] args)
- {
- ArrayList files = new ArrayList();
- String f;
- while((f=Console.ReadLine())!=null)
- {
- files.Add(Path.GetFileName(f));
- }
- string[] fs = (string[])files.ToArray(typeof(string));
- Array.Sort(fs, StrCmpLogicalW);
- foreach (string file in fs)
- {
- Console.WriteLine(file);
- }
- }
- }
复制代码
|