For /R "C:\Mikro\V15xx" %i in (*._MS) do @echo create database %~ni on (filename='%~Fi') for attach_rebuild_log; >> "C:\SQL Attach Query.sql"