通过powershell脚本,解决了。- reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /f /v "HideFileExt" /t REG_DWORD /d 0
- ;显示文件扩展名
- ping 127.0.0.1 -n 2 >nul 2>nul
-
- ——————————————————————————————————————————————————————————————————————————————
- if exist "%userprofile%\Desktop" goto :w7-pshell
- if exist "%userprofile%\桌面" goto :xp-pshell
-
- exit
-
-
-
- ————————————————————————————————————————————————
- :w7-pshell
- echo win7-pshell
-
- if exist "c:\pshell" rd /s /q "c:\pshell"
- md "c:\pshell"
-
-
-
- ———————————————————————
- md "d:\%date:~0,4%-%date:~5,2%"
- explorer "d:\%date:~0,4%-%date:~5,2%"
-
- for %%a in (e f g h i j k l m n o p q r s t) do (
- if exist "%%a:\DCIM" (
- echo %%a:\DCIM
- pause
- for %%b in (jpg arw crw cr2 nef rw2 orf raf dng x3f avi mov mp4 mts) do (
- for /f %%i in ('dir /b /s /a-d %%a:\DCIM\*.%%b') do (
- copy /y "%%~fi" "d:\%date:~0,4%-%date:~5,2%"
- del /q "%%~fi"
- )
- )
-
- for %%b in (mp4 mts) do (
- for /f %%i in ('dir /b /s /a-d %%a:\*.%%b') do (
- copy /y "%%~fi" "d:\%date:~0,4%-%date:~5,2%"
- del /q "%%~fi"
- )
- )
-
- )
- )
-
-
-
-
- ———————————————————————
- echo # >>"c:\pshell\00-copy.ps1"
- echo # 获取 Shell.Application 代理 >>"c:\pshell\00-copy.ps1"
- echo # >>"c:\pshell\00-copy.ps1"
- echo function Get-ShellProxy>>"c:\pshell\00-copy.ps1"
- echo { >>"c:\pshell\00-copy.ps1"
- echo if( -not $global:ShellProxy) { >>"c:\pshell\00-copy.ps1"
- echo $global:ShellProxy = new-object -com Shell.Application >>"c:\pshell\00-copy.ps1"
- echo }>>"c:\pshell\00-copy.ps1"
- echo $global:ShellProxy>>"c:\pshell\00-copy.ps1"
- echo } >>"c:\pshell\00-copy.ps1"
-
- echo # >>"c:\pshell\00-copy.ps1"
- echo # 查看 Shell 项>>"c:\pshell\00-copy.ps1"
- echo # >>"c:\pshell\00-copy.ps1"
- echo function Get-ShellItem>>"c:\pshell\00-copy.ps1"
- echo { >>"c:\pshell\00-copy.ps1"
- echo param($Path=17) >>"c:\pshell\00-copy.ps1"
- echo $shell=Get-ShellProxy>>"c:\pshell\00-copy.ps1"
-
- echo # 默认的 NameSpace()方法只支持目录,不支持文件 >>"c:\pshell\00-copy.ps1"
- echo # 为了增强兼容性和保持一致性,如果传入一个文件路径,可以尝试通过文件路径获取目录,然后再从目录的子项中获取Shell项 >>"c:\pshell\00-copy.ps1"
- echo trap [System.Management.Automation.MethodInvocationException]>>"c:\pshell\00-copy.ps1"
- echo { >>"c:\pshell\00-copy.ps1"
- echo $Path = $Path.ToString() >>"c:\pshell\00-copy.ps1"
- echo $dir = $Path.Substring( 0 ,$Path.LastIndexOf('\') ) >>"c:\pshell\00-copy.ps1"
- echo return $shell.NameSpace($dir).items() ^| >>"c:\pshell\00-copy.ps1"
- echo where { (-not $_.IsFolder ) -and $_.path -eq $Path} ^|>>"c:\pshell\00-copy.ps1"
- echo select -First ^1>>"c:\pshell\00-copy.ps1"
- echo continue>>"c:\pshell\00-copy.ps1"
- echo } >>"c:\pshell\00-copy.ps1"
- echo $shell.NameSpace($Path).self >>"c:\pshell\00-copy.ps1"
- echo } >>"c:\pshell\00-copy.ps1"
-
- echo # >>"c:\pshell\00-copy.ps1"
- echo # 查看 Shell 子项,支持递归和过滤>>"c:\pshell\00-copy.ps1"
- echo # >>"c:\pshell\00-copy.ps1"
- echo function Get-ChildShellItem>>"c:\pshell\00-copy.ps1"
- echo { >>"c:\pshell\00-copy.ps1"
- echo param(>>"c:\pshell\00-copy.ps1"
- echo $Path=17,>>"c:\pshell\00-copy.ps1"
- echo [switch]$Recurse,>>"c:\pshell\00-copy.ps1"
- echo $Filter=$null) >>"c:\pshell\00-copy.ps1"
-
- echo #内部过滤器>>"c:\pshell\00-copy.ps1"
- echo Filter myFilter>>"c:\pshell\00-copy.ps1"
- echo {>>"c:\pshell\00-copy.ps1"
- echo if($Filter){>>"c:\pshell\00-copy.ps1"
- echo $_ ^| where { $_.Name -match $Filter } >>"c:\pshell\00-copy.ps1"
- echo }>>"c:\pshell\00-copy.ps1"
- echo else{>>"c:\pshell\00-copy.ps1"
- echo $_>>"c:\pshell\00-copy.ps1"
- echo }>>"c:\pshell\00-copy.ps1"
- echo }>>"c:\pshell\00-copy.ps1"
-
- echo $shellItem = Get-ShellItem $Path>>"c:\pshell\00-copy.ps1"
- echo $shellItem ^| myFilter>>"c:\pshell\00-copy.ps1"
- echo # 如果是目录 >>"c:\pshell\00-copy.ps1"
- echo if( $shellItem.IsFolder ){>>"c:\pshell\00-copy.ps1"
- echo # 如果指定递归 >>"c:\pshell\00-copy.ps1"
- echo if($Recurse) { >>"c:\pshell\00-copy.ps1"
- echo $shellItem ^| myFilter>>"c:\pshell\00-copy.ps1"
- echo $stack=New-Object System.Collections.Stack>>"c:\pshell\00-copy.ps1"
- echo # 当前目录压入堆栈 >>"c:\pshell\00-copy.ps1"
- echo $stack.Push($shellItem)>>"c:\pshell\00-copy.ps1"
- echo while($stack.Count -gt 0)>>"c:\pshell\00-copy.ps1"
- echo {>>"c:\pshell\00-copy.ps1"
- echo # 访问栈顶元素>>"c:\pshell\00-copy.ps1"
- echo $top = $stack.Pop()>>"c:\pshell\00-copy.ps1"
- echo $top ^| myFilter>>"c:\pshell\00-copy.ps1"
-
- echo # 访问栈顶元素的子元素>>"c:\pshell\00-copy.ps1"
- echo $top.GetFolder.items() ^| foreach {>>"c:\pshell\00-copy.ps1"
- echo if( $_.IsFolder )>>"c:\pshell\00-copy.ps1"
- echo { $stack.Push($_) }>>"c:\pshell\00-copy.ps1"
- echo else { $_ ^| myFilter }>>"c:\pshell\00-copy.ps1"
- echo }>>"c:\pshell\00-copy.ps1"
- echo }>>"c:\pshell\00-copy.ps1"
- echo } >>"c:\pshell\00-copy.ps1"
- echo else{ >>"c:\pshell\00-copy.ps1"
- echo $shellItem.GetFolder.items() ^| myFilter }>>"c:\pshell\00-copy.ps1"
- echo } >>"c:\pshell\00-copy.ps1"
- echo } >>"c:\pshell\00-copy.ps1"
-
- echo # >>"c:\pshell\00-copy.ps1"
- echo # 复制Shell项>>"c:\pshell\00-copy.ps1"
- echo # >>"c:\pshell\00-copy.ps1"
- echo function Copy-ShellItem>>"c:\pshell\00-copy.ps1"
- echo {>>"c:\pshell\00-copy.ps1"
- echo param($Path,$Destination)>>"c:\pshell\00-copy.ps1"
- echo $shell=Get-ShellProxy>>"c:\pshell\00-copy.ps1"
- echo $shell.NameSpace($Destination).Copyhere($Path,4)>>"c:\pshell\00-copy.ps1"
- echo }>>"c:\pshell\00-copy.ps1"
-
- echo # >>"c:\pshell\00-copy.ps1"
- echo # 删除Shell项>>"c:\pshell\00-copy.ps1"
- echo # >>"c:\pshell\00-copy.ps1"
- echo function Remove-ShellItem>>"c:\pshell\00-copy.ps1"
- echo {>>"c:\pshell\00-copy.ps1"
- echo param($Path)>>"c:\pshell\00-copy.ps1"
- echo $ShellItem = Get-ShellItem $Path>>"c:\pshell\00-copy.ps1"
- echo $ShellItem.InvokeVerb('delete')>>"c:\pshell\00-copy.ps1"
- echo }>>"c:\pshell\00-copy.ps1"
-
- echo # >>"c:\pshell\00-copy.ps1"
- echo # 移动Shell项>>"c:\pshell\00-copy.ps1"
- echo # >>"c:\pshell\00-copy.ps1"
- echo function Move-ShellItem>>"c:\pshell\00-copy.ps1"
- echo {>>"c:\pshell\00-copy.ps1"
- echo param($Path,$Destination)>>"c:\pshell\00-copy.ps1"
- echo $shell=Get-ShellProxy>>"c:\pshell\00-copy.ps1"
- echo $shell.NameSpace($Destination).MoveHere($Path,16)>>"c:\pshell\00-copy.ps1"
- echo }>>"c:\pshell\00-copy.ps1"
-
-
- echo # 文件存放的地址>>"c:\pshell\00-copy.ps1"
- echo $des = 'D:\'>>"c:\pshell\00-copy.ps1"
-
-
-
- echo # 匹配相机的关键字,比如:canon,nokia,Windows Phone>>"c:\pshell\00-copy.ps1"
- echo $keywords = 'canon','nokia','Windows Phone'>>"c:\pshell\00-copy.ps1"
- echo foreach ($keyword in $keywords)>>"c:\pshell\00-copy.ps1"
- echo {>>"c:\pshell\00-copy.ps1"
-
- echo $phones = Get-ChildShellItem ^| where { $_.name -like "*$keyword*" }>>"c:\pshell\00-copy.ps1"
- echo foreach ($phone in $phones)>>"c:\pshell\00-copy.ps1"
- echo {>>"c:\pshell\00-copy.ps1"
-
- echo if($phone -eq $null)>>"c:\pshell\00-copy.ps1"
- echo {>>"c:\pshell\00-copy.ps1"
- echo break>>"c:\pshell\00-copy.ps1"
- echo }>>"c:\pshell\00-copy.ps1"
-
- echo Get-ChildShellItem -Path "$($phone.Path)" -Recurse -Filter '((.jpg)^|(.crw)^|(.cr2)^|(.avi)^|(.mov)^|(.mp4))$' ^| foreach {>>"c:\pshell\00-copy.ps1"
- echo #获取照片创建日期>>"c:\pshell\00-copy.ps1"
- echo $datestr = $_.Parent.GetDetailsOf($_,3)>>"c:\pshell\00-copy.ps1"
- echo $datestr=(get-date).tostring("yyyy-MM")>>"c:\pshell\00-copy.ps1"
- echo #新建日期文件夹>>"c:\pshell\00-copy.ps1"
- echo $dir = Join-Path $des $datestr>>"c:\pshell\00-copy.ps1"
- echo if( -not (Test-Path $dir) ) {>>"c:\pshell\00-copy.ps1"
- echo mkdir $dir>>"c:\pshell\00-copy.ps1"
- echo }>>"c:\pshell\00-copy.ps1"
-
- echo # 如果文件存在,先删掉>>"c:\pshell\00-copy.ps1"
- echo $file="{0}\{1}" -f $dir,$_.name>>"c:\pshell\00-copy.ps1"
- echo if( test-path $file) { remove-item $file }>>"c:\pshell\00-copy.ps1"
-
- echo # 复制文件>>"c:\pshell\00-copy.ps1"
- echo Copy-ShellItem -Path $_ -Destination $dir>>"c:\pshell\00-copy.ps1"
- echo # 移动文件>>"c:\pshell\00-copy.ps1"
- echo # move-ShellItem -Path $_ -Destination $dir>>"c:\pshell\00-copy.ps1"
-
-
- echo }>>"c:\pshell\00-copy.ps1"
- echo }>>"c:\pshell\00-copy.ps1"
- echo }>>"c:\pshell\00-copy.ps1"
-
-
- echo exit>>"c:\pshell\00-copy.ps1"
-
- echo $des = [environment]::GetFolderPath([System.Environment+SpecialFolder]::MyPictures)>>"c:\pshell\00-copy.ps1"
-
-
- ping 127.0.0.1 -n 3 >nul 2>nul
-
-
-
-
- ———————————————————————
- ftype Microsoft.Powershellscript.1="c:\system32\windowspowershell\v1.0\powershell.exe" "%%1"
- ping 127.0.0.1 -n 2 >nul 2>nul
-
-
-
- echo powershell>>c:\pshell\00-copy.bat
-
- echo WSH.Sleep 2000>>"c:\pshell\00-copy.vbs
- echo set ws=wscript.createobject("wscript.shell")>>c:\pshell\00-copy.vbs
- echo ws.sendkeys "Set-ExecutionPolicy Unrestricted -force{Enter}">>c:\pshell\00-copy.vbs
- echo ws.sendkeys "exit{Enter}">>c:\pshell\00-copy.vbs
- echo ws.sendkeys "exit{Enter}">>c:\pshell\00-copy.vbs
-
-
- start c:\pshell\00-copy.bat
- ping 127.0.0.1 -n 5 >nul 2>nul
-
- start c:\pshell\00-copy.vbs
- ping 127.0.0.1 -n 4 >nul 2>nul
-
- powershell -file "c:\pshell\00-copy.ps1"
-
- explorer "d:\%date:~0,4%-%date:~5,2%"
-
- exit
-
-
- ————————————————————————————————————————————————
- :xp-pshell
-
- exit
复制代码
|