![]() ![]() | can't be used to pass an output value to set for /f doesn't support some characters in it's subject value (the path to edit), if without in-text Escaping for /l doesn't allow to change the count/condition values (after start) !>:>*! doesn't work. ![]() The previous version may be not requiring enableDelayedExpansion enableExtensions, but can't run in for loops. I'm not sure about remote ones, but for local Windows trough, %~z does work for %%x in ("\\ComputerName\temp\temp.txt") do set "size=%%~zx" If /i "%filesize%" NEQ "%filesize2%" goto:onemoretime2 If /i "%filesize:~-1%" EQU " " goto:RemoveTrailingSpace If /i "%fileExclPath%" NEQ "%fileExclPath2%" goto:onemoretimeĭir /s /a-d "%workingdir%">"%temp%\temp.txt"įindstr /C:"%fileExclPath%" "%temp%\temp.txt" >"%temp%\temp2.txt" I'm sure there are more efficient ways of doing this using VBScript, or PowerShell or whatever, but I didn't want to do any of that good ol' batch for me! set file=C:\Users\Admin\Documents\test.jpg The below code works for files in any location, and I wrote it myself. However, it's inferior code, because it doesn't work for files saved on a network drive (for example, \\Nas\test.jpg and \\192.168.2.40\test.jpg). In a batch file, the below works for local files, but fails for files on network hard drives for %%I in ("test.jpg") do filesize=%~z1 Wscript.Echo objFile.Name & " " & objFile.Filesize / 1024 / 1024 & "MB" ("Select * from CIM_DataFile where FileSize > '" & intSizeBytes & "'") Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Using VBScript ' This code finds all files over a certain size. The /s option means subdirectories from the specified path (in this case, the D: drive) are searched. The /x:104857600 option causes files over 104,857,600 bytes to be displayed and is valid only if you include the /v option (verbose). The following command displays files over 100 MB in size on the D: drive: diskuse D: /x:104857600 /v /s Use the diskuse command to find files over a certain size. ![]() The /s option causes subdirectories to be searched, the /m option displays disk usage in megabytes, the /q:100 option causes folders that are greater than 100 MB to be marked, and the /d option displays only folders that exceed the threshold specified by /q. The following command finds folders that are greater than 100 MB in size on the D: drive: diruse /s /m /q:100 /d d: ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |