比较.Bat

时间:2016-10-27 17:29:14

标签: windows batch-file cmd

我试图获取图像的文件大小,以便我可以将它们与两个标准中的一个(1920x1080或1080x1920)进行比较。如果我的图像与我要删除的标准不匹配。我试图这样做的原因是,当我从Windows聚光灯文件夹中提取图像时,我可以对它们进行排序并删除不匹配的文件。我还没有多少,但这里是我的代码库

xcopy %localappdata%\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets C:\Users\%Username%\Pictures\"Windows Spotlight"
D
cd \
cd Users\%Username%\Pictures\"Windows Spotlight"
ren * *.jpg

https://github.com/CamoJackson/WinSpotlight-Copy。我研究了WMIC,但我对此并不了解。任何想法。

编辑:我查看了目录,我尝试使用的文件都超过200mb,我不想要的文件不到100mb。使用~zA我可以比较该文件大小。

1 个答案:

答案 0 :(得分:0)

或使用BAT / VBS:

图片尺寸的

使用以下值: 31

示例:

GetMediaInfo.bat“Path_to_the_folder”“Image_name”31

::GetMediaInfo.bat
::By SachaDee - 2016

::Usage
::GetMediaInfo.bat "Folder" "File" "Value of the Info to GET"

::Possible Value Example :

:: 27 = Media Duration for video or music files
:: 28 = Bits Rate in Kbs/s
:: 31 = Dimensions of an image


::Output
::Information du media
@echo off

  If not exist "#.vbs" call:construct
  For /f "delims=" %%a in ('cscript //nologo #.vbs "%~1" "%~2" "%~3"') do set $MediaInfo=%%a

echo %$MediaInfo%
exit/b

:construct
(echo.dim objShell&echo.dim objFolder&echo.dim objFolderItem&echo.set objShell = CreateObject("shell.application"^)&echo.set objFolder = objShell.NameSpace(wscript.arguments(0^)^)&echo.set objFolderItem = objFolder.ParseName(wscript.arguments(1^)^)&echo.dim objInfo&echo.objInfo = objFolder.GetDetailsOf(objFolderItem, wscript.arguments(2^)^)&echo.wscript.echo objinfo)>#.vbs

可能值的列表(取决于文件类型):

Name - 0
Size - 1
Item type - 2
Date modified - 3
Date created - 4
Date accessed - 5
Attributes - 6
Offline status - 7
Offline availability - 8
Perceived type - 9
Owner - 10
Kind - 11
Date taken - 12
Contributing artists - 13
Album - 14
Year - 15
Genre - 16
Conductors - 17
Tags - 18
Rating - 19
Authors - 20
Title - 21
Subject - 22
Categories - 23
Comments - 24
Copyright - 25
Length - 27
Bit rate - 28
Protected - 29
Camera model - 30
Dimensions - 31
Camera maker - 32
Company - 33
File description - 34
Program name - 35
Duration - 36
Is online - 37
Is recurring - 38
Location - 39
Optional attendee addresses - 40
Optional attendees - 41
Organizer address - 42
Organizer name - 43
Reminder time - 44
Required attendee addresses - 45
Required attendees - 46
Resources - 47
Meeting status - 48
Free/busy status - 49
Total size - 50
Account name - 51
Task status - 52
Computer - 53
Anniversary - 54
Assistant's name - 55
Assistant's phone - 56
Birthday - 57
Business address - 58
Business city - 59
Business P.O. box - 60
Business postal code - 61
Business state or province - 62
Business street - 63
Business fax - 64
Business home page - 65
Business phone - 66
Callback number - 67
Car phone - 68
Children - 69
Company main phone - 70
Department - 71
E-mail address - 72
E-mail2 - 73
E-mail3 - 74
E-mail list - 75
E-mail display name - 76
File as - 77
First name - 78
Full name - 79
Gender - 80
Given name - 81
Hobbies - 82
Home address - 83
Home city - 84
Home country/region - 85
Home P.O. box - 86
Home postal code - 87
Home state or province - 88
Home street - 89
Home fax - 90
Home phone - 91
IM addresses - 92
Initials - 93
Job title - 94
Label - 95
Last name - 96
Mailing address - 97
Middle name - 98
Cell phone - 99
Cell phone - 100
Nickname - 101
Office location - 102
Other address - 103
Other city - 104
Other country/region - 105
Other P.O. box - 106
Other postal code - 107
Other state or province - 108
Other street - 109
Pager - 110
Personal title - 111
City - 112
Country/region - 113
P.O. box - 114
Postal code - 115
State or province - 116
Street - 117
Primary e-mail - 118
Primary phone - 119
Profession - 120
Spouse/Partner - 121
Suffix - 122
TTY/TTD phone - 123
Telex - 124
Webpage - 125
Content status - 126
Content type - 127
Date acquired - 128
Date archived - 129
Date completed - 130
Device category - 131
Connected - 132
Discovery method - 133
Friendly name - 134
Local computer - 135
Manufacturer - 136
Model - 137
Paired - 138
Classification - 139
Status - 140
Client ID - 141
Contributors - 142
Content created - 143
Last printed - 144
Date last saved - 145
Division - 146
Document ID - 147
Pages - 148
Slides - 149
Total editing time - 150
Word count - 151
Due date - 152
End date - 153
File count - 154
Filename - 155
File version - 156
Flag color - 157
Flag status - 158
Space free - 159
Bit depth - 160
Horizontal resolution - 161
Width - 162
Vertical resolution - 163
Height - 164
Importance - 165
Is attachment - 166
Is deleted - 167
Encryption status - 168
Has flag - 169
Is completed - 170
Incomplete - 171
Read status - 172
Shared - 173
Creators - 174
Date - 175
Folder name - 176
Folder path - 177
Folder - 178
Participants - 179
Path - 180
By location - 181
Type - 182
Contact names - 183
Entry type - 184
Language - 185
Date visited - 186
Description - 187
Link status - 188
Link target - 189
URL - 190
Media created - 191
Date released - 192
Encoded by - 193
Producers - 194
Publisher - 195
Subtitle - 196
User web URL - 197
Writers - 198
Attachments - 199
Bcc addresses - 200
Bcc - 201
Cc addresses - 202
Cc - 203
Conversation ID - 204
Date received - 205
Date sent - 206
From addresses - 207
From - 208
Has attachments - 209
Sender address - 210
Sender name - 211
Store - 212
To addresses - 213
To do title - 214
To - 215
Mileage - 216
Album artist - 217
Album ID - 218
Beats-per-minute - 219
Composers - 220
Initial key - 221
Part of a compilation - 222
Mood - 223
Part of set - 224
Period - 225
Color - 226
Parental rating - 227
Parental rating reason - 228
Space used - 229
EXIF version - 230
Event - 231
Exposure bias - 232
Exposure program - 233
Exposure time - 234
F-stop - 235
Flash mode - 236
Focal length - 237
35mm focal length - 238
ISO speed - 239
Lens maker - 240
Lens model - 241
Light source - 242
Max aperture - 243
Metering mode - 244
Orientation - 245
People - 246
Program mode - 247
Saturation - 248
Subject distance - 249
White balance - 250
Priority - 251
Project - 252
Channel number - 253
Episode name - 254
Closed captioning - 255
Rerun - 256
SAP - 257
Broadcast date - 258
Program description - 259
Recording time - 260
Station call sign - 261
Station name - 262
Summary - 263
Snippets - 264
Auto summary - 265
Search ranking - 266
Sensitivity - 267
Shared with - 268
Sharing status - 269
Product name - 270
Product version - 271
Support link - 272
Source - 273
Start date - 274
Billing information - 275
Complete - 276
Task owner - 277
Total file size - 278
Legal trademarks - 279
Video compression - 280
Directors - 281
Data rate - 282
Frame height - 283
Frame rate - 284
Frame width - 285
Total bitrate - 286