@thekc Did you copy the entire command, both lines, into command prompt? I haven't seen the command not work, which is why I ask.
Another way to find this information is to open a File Explorer window and right-click Documents in the left panel, then select Properties > General. The file path will show up as the Location. I'm guessing it'll be the same location as what you see in-game though—the Sims 4 folder almost always lands in the default location of Documents, wherever that is. So you don't need to list this file path unless the suggestion below doesn't help.
What you can try is setting OneDrive to not sync the contents of Documents at all:
https://support.microsoft.com/en-us/office/choose-which-onedrive-folders-to-sync-to-your-computer-98b8b011-8b94-419b-aa95-a14ff2415e85
You may first need to pause syncing and/or cancel the current sync:
https://support.microsoft.com/en-us/office/how-to-cancel-or-stop-sync-in-onedrive-4885c27e-3d89-4d69-be75-2646c71367d3
Before you do anything else, make a backup copy of the Sims 4 folder in Documents > Electronic Arts and store it somewhere else. An external drive or USB stick would be ideal, but in a pinch, you can drop the backup copy in the Downloads folder, which OneDrive doesn't touch. The point of this is that OneDrive may remove the local copy of the folder, leaving only the one in cloud storage. This is typically fine since you can just download it again, but if the sync process is interrupted, some files may not make it to cloud storage at all.
Point is, right-click the folder and select Copy, then right-click where you're going to place the backup and select Paste. Once you've done that, you can change settings without worrying about files getting deleted.
If the above doesn't prevent OneDrive from syncing your files, you can move the location of Documents. But that's an extra step that may not be necessary here, so please try this suggestion first.