Solved! Go to Solution.
To enhance the answer from David above. This option gives you only the layer name if you use drop down menu in Merge tool. If you browse to the file using Browse button it gives you the data path. However, it is very easy to include absolute path to the layers you are merging with only couple of lines in Python window (or if you create the actual Python script) without a need to use tedious Browse button in Merge tool.
Usual workflow is that your project contains at least one Map frame (data frame) and more often than that many layers beside the ones you want to merge. So best way is to create Group Layer where you put only layers that you want to merge. Having this then just open Python window (View > Python window) and paste the code from below with slight modification to the Python window.
proj = arcpy.mp.ArcGISProject('CURRENT')
# You might have many data frames in your project and you don't know which position in your list has. Change line item.name == "Map": to the name that you have. Default is Map but you might have anything
for index, item in enumerate(proj.listMaps()):
if item.name == "Map":
# You want to process only relevant Data Frame (aka Map)
mf = proj.listMaps()[index]
mfl = mf.listLayers()
lyr_names = []
for ly in mfl:
# Change to your Group Layer name. So Merging to whatever you have
if ly.isGroupLayer and ly.name == "Merging":
lyrs = ly.listLayers()
for lyr in lyrs:
desc = arcpy.Describe(lyr)
# arcpy.Describe catalogPath gives you the full path to data. So also the extension .shp for ESRI Shapefile if you have any
lyr_names.append(desc.catalogPath)
# Because you are passing the full path to this tool it will write the absolute path and not the layer name.
# Change the output path (in this case D:\testing\testing2022\test.gdb\bbb) to whatever fits you
arcpy.management.Merge(lyr_names, r"D:\testing\testing2022\test.gdb\bbb", "" , "ADD_SOURCE_INFO")