This can't be simply achieved through a work item query or tf command. You may have to use TFS API.
Detail steps should be Getting your Work Item for TFS server, then can all of the Files/Items that were modified and associated with this Work Item, get all of the changeset from a collection of links (Links in a Work Item), list all files in those changsets.
/// <summary>
/// Get all of the Files/Items that were modified and associated with a Work Item
/// </summary>
/// <param name="teamProject">Name of the Team Project</param>
/// <param name="workItemID">The work item ID</param>
/// <returns>List of changes</returns>
public List<FileItem> GetAllFilesModifiedForWorkItem(string teamProject, int workItemID)
{
WorkItemCollection workItems = GetWorkItems(teamProject, workItemID);
if (workItems.Count == 0)
{
Console.WriteLine("No Items found for Work Item ID: " + workItemID);
return null;
}
WorkItem item = workItems[0];
Console.WriteLine("Work Item {0} has {1} Links", workItemID, item.Links.Count);
if(item.Links.Count == 0)
return null;
List<Changeset> lstChangesets = GetChangesets(item.Links);
Console.WriteLine("Work Item {0} has {1} Changesets", workItemID, lstChangesets.Count);
if (lstChangesets.Count == 0)
return null;
List<FileItem> lstItems = GetItemsForChangeset(lstChangesets);
Console.WriteLine("Work Item {0} has {1} Items (changes)", workItemID, lstItems.Count);
if (lstItems.Count == 0)
return null;
return lstItems;
}
The whole code and more detail info please refer this blog: How to get all files modified for a work item in TFS
Moreover, you can also try to use TFS Sidekicks which will also return all the changes for that workitem. Detail ways please refer jagberg's answer in this question: get all changed files for a TFS workitem