[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
  1. dir "W" -dir |
  2. where{
  3. (dir $_.fullname -File -dep 2).name -contains "YES"
  4. }
复制代码
  1. gci task5 -File -rec  -include "YES"
复制代码

TOP

回复 4# 5i365


呃就是些基础常识呀
1楼原因就是你把cd切换当前目录这步省了呀,又没把路径补上
2楼help dir有说明

TOP

回复 6# 5i365


    放的位置不对
  1. #@&cls&cd "C:\Users\Administrator\Desktop\新建文件夹"&powershell "type '%~0'|out-string|iex"&pause&exit
  2. [void][Reflection.Assembly]::LoadWithPartialName('System.Drawing')
  3. dir *.bmp |
  4. foreach{
  5. $image = [Drawing.Image]::FromFile($_.FullName)
  6. #$image.Save($($_.BaseName + '.jpg'), [Drawing.Imaging.ImageFormat]::Jpeg)
  7. $s=$_.BaseName
  8. $image.Save("$s.jpg", [Drawing.Imaging.ImageFormat]::Jpeg)
  9. $image.Dispose()
  10. }
复制代码

TOP

回复 8# 5i365

官方文档里什么都有呀
  1. https://docs.microsoft.com/zh-cn/powershell/module/microsoft.powershell.core/about/about_automatic_variables#pwd
复制代码
  1. [void][Reflection.Assembly]::LoadWithPartialName('System.Drawing')
  2. $a="C:\Users\Administrator\Desktop\新建文件夹"
  3. [System.Environment]::CurrentDirectory=$a
  4. cd $a
  5. dir *.bmp |
  6. foreach{
  7. $image = [Drawing.Image]::FromFile($_.FullName)
  8. #$image.Save($($_.BaseName + '.jpg'), [Drawing.Imaging.ImageFormat]::Jpeg)
  9. $s=$_.BaseName
  10. $image.Save("$s.jpg", [Drawing.Imaging.ImageFormat]::Jpeg)
  11. $image.Dispose()
  12. }
复制代码
1

评分人数

    • 5i365: 乐于助人, 技术牛X技术 + 1

TOP

返回列表