- /*&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
- >"%tmp%\$" more +25 "%~f0"
- "%cscpath%" /out:"%tmp%\$Expdir.exe" "%tmp%\$"
- (for /f "delims=" %%a in ('dir /ad /b') do (
- setlocal enabledelayedexpansion
- for /f "delims=" %%b in ('%tmp%\$Expdir.exe "%~dp0%%a"') do (
- set /a n+=1
- if !n! equ 1 set "#1=%%~nxb"
- set "#n=%%~nxb"
- )
- if defined n if !n! equ 1 (echo;%%a !#1! !n!) else echo;%%a !#1! !#n! !n!
- endlocal
- ))>"%~dp0结果.txt"
- pause&exit
- */
- using System;
- using System.IO;
- 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)
- {
- String path = args.Length>0?args[0].ToString():Environment.CurrentDirectory;
- string[] files = Directory.GetFiles(path);
- Array.Sort(files, StrCmpLogicalW);
- foreach (string file in files)
- {
- Console.WriteLine(file);
- }
- }
- }
复制代码
|