Make AWK Scripts Executable on Microsoft Windows Systems

You love working with the good old awk language for pattern scanning and text processing? Usually it’s sufficient to use awk fast and easy with one-line programs directly on command line. But sometimes it may be needful to write more extensive programs in script files e.g. for algorithm prototyping or more complex text processing applications. For recurring tasks it may be more comfortable to utilize executable awk scripts.


  • Open cmd as admin
  • Choose a file name extension for your executable awk scripts e.g. .awk
  • Associate your file name extension with a file type denomination e.g. awkExec
    ASSOC .awk=awkExec
  • Link your file type with an awk interpreter. I use gawk.exe from a Git for Windows installation. You can download gawk for Windows separately from sourceforge. Make sure that the path below leads to your awk interpreter location
    FTYPE awkExec=C:\Program Files\Git\usr\bin\gawk.exe -f %1 %*

    The option -f is important to pass program files to gawk. %1 is replaced with the file name containing your awk code. %* is replaced with all of the parameters (e.g. an ascii file to be processed by the awk program). See for more details concerning FTYPE.

  • To reduce typing effort when using your AWK executable at command line, add .awk at PATHEXT under system environment variables. After that you can start your awk program by typing just the filename, without file name extension


Enjoy your executable awk scripts!

Yours faithfully,

Dennis Vier



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s