Get link to a specific template file [closed]

Here’s a function to print the URI of the first page using an “Archive” page template. It assumes the template is named template-archive.php (don’t name it archive.php and hijack the Template Hierarchy!). You can either drop this in functions.php and call it in a template or you can just use the code within the function directly in a template file.

function wpse25797_the_archives_link() {
    $archive_page = get_pages(
        array(
            'meta_key' => '_wp_page_template',
            'meta_value' => 'template-archive.php'
        )
    );
    $archive_id = $showcase_page[0]->ID;
    echo get_permalink( $archive_id );
}