I've seen a similar question here. That one works fine with Linux but don't work for windows.
For windows, use these commands:
lex file.l
gcc lex.yy.c
a.exe
But make sure your PC has lex
installed.
You can learn more about the installation here if needed.