操屁眼的视频在线免费看,日本在线综合一区二区,久久在线观看免费视频,欧美日韩精品久久综

新聞資訊

    以下腳本使用.Shell獲取的快捷方式的源文件,我想改成使用調用外部命令行的方式來實現。

    但當我把19行 $p = $shell.($_). 這一行代碼替換成

    1. $OutputVariable = (cmd.exe /c "E:\Shortcut.exe" /F:$_ /A:Q | findstr TargetPath=) | Out-String
    2. $p = $OutputVariable.Substring(11)
    復制代碼

    就提示找不到源文件復制找不到源文件,如果能解決復制找不到源文件,可以給與報酬

    由于論壇無法上傳附件,外部命令行程序.exe見網址: ... amp;fweb=1&cl=1

    下面是整個腳本代碼

    1. using namespace 'Microsoft.PowerShell.Commands.AddType.AutoGeneratedTypes'
    2. using namespace 'System.Windows.Forms'
    3. using namespace 'System.Collections.Specialized';cls
    4. [void][System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')
    5. Add-Type -Name 'WinApi' -MemberDefinition '[DllImport("user32.dll")]public static extern short GetKeyState(uint VK);'
    6. $shell = New-Object -ComObject 'WScript.Shell'
    7. $paths = New-Object 'StringCollection'
    8. $arr_err = New-Object 'System.Collections.ArrayList'
    9. if([WinApi]::GetKeyState(16) -band 0x8000){ write-host 'shift';$paths = [Clipboard]::GetFileDropList() }
    10. $args | foreach { [void]$paths.Add($_) }
    11. $paths = &{
    12. $paths | Select-Object -Unique | foreach {
    13. #目錄
    14. if([System.IO.Directory]::Exists($_)){ return $_ }
    15. #文件
    16. if([System.IO.File]::Exists($_)){
    17. #lnk文件
    18. if($_.EndsWith('.lnk')){
    19. $p = $shell.CreateShortcut($_).TargetPath
    20. if([System.IO.File]::Exists($p)){ return $p }
    21. if([System.IO.Directory]::Exists($p)){ return $p }
    22. ? ?? ?? ?? ?? ? [void]$arr_err.Add(('{0} -> {1}' -f $_,$p))
    23. return $null
    24. }
    25. #其它文件
    26. return $_
    27. }
    28. } | Select-Object -Unique
    29. }
    30. if($paths.Count -gt 0){
    31. [Clipboard]::SetFileDropList($paths)
    32. 'ok'
    33. $paths
    34. '-----------'
    35. }
    36. if($arr_err.Count -gt 0){
    37. 'fail'
    38. $arr_err
    39. '-----------'
    40. pause
    41. }
    復制代碼

網站首頁   |    關于我們   |    公司新聞   |    產品方案   |    用戶案例   |    售后服務   |    合作伙伴   |    人才招聘   |   

友情鏈接: 餐飲加盟

地址:北京市海淀區    電話:010-     郵箱:@126.com

備案號:冀ICP備2024067069號-3 北京科技有限公司版權所有