In SQL Server while restoring database .bak file are are two option "Relocate all files to folder" and "Restore As". I can change the location of database using "Restore As" option, what is the purpose of "Relocate all files to folder" option?
This "Relocate all files to folder" option is like using WITH MOVE to restore a COPY of the same DB, which the [BAK] backup file is derived, on an instance of SQL Server where [the original source DB] it already exists but with no duplicated physical file path and file names, and you can optionally change the logical file names too if you wish to make these values different.
This basically tells it to restore this database from this backup file, but rather than using the metadata SQL recognizes for the restore parameters for the physical (and optionally the logic) file names, use these explicit values instead. This should update the system tables in msdb, etc. accordingly as well.
Relocates restored files