batch script - run command on each file in directory

前端 未结 4 1719
春和景丽
春和景丽 2020-12-05 00:03

I need to convert some xls files into xlsx files. I can successfully convert one xls file into xlsx by running this command into cmd prompt (windows):

ssconv         


        
4条回答
  •  死守一世寂寞
    2020-12-05 00:44

    you can run something like this (paste the code bellow in a .bat, or if you want it to run interractively replace the %% by % :

    for %%i in (c:\directory\*.xls) do ssconvert %%i %%i.xlsx
    

    If you can run powershell it will be :

    Get-ChildItem -Path c:\directory -filter *.xls | foreach {ssconvert $($_.FullName) $($_.baseName).xlsx }
    

提交回复
热议问题