SoFunction
Updated on 2025-04-09

Batch processing imports the file name in the file into the corresponding name of the table

Use batch processing to import the photo name in the photo file into the corresponding name of the table 1

Method 1

/*&cls
 @echo off
 dir /b "Photo\*.jpg"|cscript -nologo -e:jscript "%~f0"
 pause & exit/b
 */

var jpglist = '';
while(!){
  jpglist += ()+'\r';
}
var fd = new ActiveXObject("").GetFolder(".").Path
var objExcel = new ActiveXObject("");
var objBook = (fd+'\\');
(1).activate;
var objSheet = ;
var cnt = ;
for(var i = 1; i<=cnt; i++) {
  var A1 = (i, 1).value;
  var re = new RegExp("[^\\r]*?"+A1+"[^\\r]*?\\.jpg","ig");
  var m = (re);
  if(m)(i, 2).value = m[0];
}
(fd+'\\');
();
();

Method 2 (more simplified):

@echo off
>$ dir /b "Photo\*.jpg"
(for /f "tokens=1 delims=, " %%a in () do (
  set /p"=%%a,"
  findstr "%%a" $||echo;
))<nul>
del $
pause