Open Notepad on the computer
Add the following and edit as needed
@echo off
cls
net use y: /delete
net use y: \\unc-Path /PERSISTENT:YES
end
If a password is needed to access the share. This is best added in the windows password manager. not in the bat file as the username and password would be shared in clear text with logs.