Puoi anche usare il porting per Windows del comando FILE (dai un'occhiata a cygwin...).