I have a post-build script in Visual Studio that I am trying to run so that we can make remote deployments easier. Earlier in this script (you don't see it here), we hard-code the user in the net use execution below. So all we're doing here is having the user input the server name and database to deploy to and then connect to the network share of that server.
What I've found though is that the code below works fine only if you run it with Command Prompt. It opens up a new window and has the user put in the server and database and then the net use command will correctly show the server the user input, all in the same window.
If you try to use this in a batch file or in Visual Studio though, the net use command shows blank for the server name.
I appreciate any insight anyone might have on this!
START CMD /C "CALL SET /P SERVERNAME=Please Enter The Server Name: & CALL SET /P DATABASE=Please Enter The Database Name: & CALL CMD /C net use \\%SERVERNAME%\d$ /persistent:no * /user:%user%"