I didn't know if I should start this topic under "Programming" but it seems to be the only place to put it.
I want to run a batch file that will automatically map a network drive before it continues the script. The problem I have is that if for some reason the drive is already mapped, or the batch file has been run twice in one session, the "net use" command returns an error. The script still works in the end, but I would like to bypass the "net use" command altogether if the drive is already mapped.
I've been digging through the net trying to find anything that can help me out, but to no avail. The closest thing I can find is just typing "net use" can tell you if the drive is already mapped or not, but I can't take any one piece of that result and use it in my script.
Does anyone have any suggestions? My purpose here is to write an IF statement that determines:
IF drive X: is already mapped, then skip net use command and proceed with the remainder of the script.
ELSE, run net use command and proceed with the remainder of the script.
I figured ERRORLEVEL could come in handy, but that only works after I get the error that I'm trying to avoid in the first place.
PC gaming market is being killed by the high prices of GPU's and all these smaller LLM's that people are playing with are causing it. That and greed.
AMD is still way behind NVIDIA. The number of games that still does not support FRS3 is bad, FRS4 is a even worse, and on the flip side you have to look far and wide to find a game that does not support DLSS (newer games). Then there is power consumption which AMD always lags behind in.
Yeah, HDMI 2.1 was a complete scam. It had a lot of impressive improvements over 2.0, but they were basically all optional, so seeing a HDMI 2.1 badge on a box or device meant nothing.
Wasn't that issue that they refused to allow the HDMI support being included in an open-sourced format? If I'm remembering that correctly, then it seems like an easy workaround would be to let people choose to either install proprietary precompiled drivers with HDMI support, or open-source drivers that don't include the super-secret HDMI stuff the Forum is so worried about.
I know proprietary anything is the antithesis of the FOSS community, but if the HDMI Forum creates legal obstacles to using important hardware features of your devices, then I think offering both options is a reasonable workaround.
I'm really hoping they don't remove the drivers from the Microsoft Update Catalog at least.
An offline, alternate options is Snappy Driver Installer Origin - https://www.snappy-driver-installer.org/
Recently, to get a Serial Port-USB cable adapter to work correctly (updating an old handheld GPS), I had to downgrade the driver from the 2024 to the 2021 version.
Question
Xtreme $niper
I didn't know if I should start this topic under "Programming" but it seems to be the only place to put it.
I want to run a batch file that will automatically map a network drive before it continues the script. The problem I have is that if for some reason the drive is already mapped, or the batch file has been run twice in one session, the "net use" command returns an error. The script still works in the end, but I would like to bypass the "net use" command altogether if the drive is already mapped.
I've been digging through the net trying to find anything that can help me out, but to no avail. The closest thing I can find is just typing "net use" can tell you if the drive is already mapped or not, but I can't take any one piece of that result and use it in my script.
Does anyone have any suggestions? My purpose here is to write an IF statement that determines:
IF drive X: is already mapped, then skip net use command and proceed with the remainder of the script.
ELSE, run net use command and proceed with the remainder of the script.
I figured ERRORLEVEL could come in handy, but that only works after I get the error that I'm trying to avoid in the first place.
Thanks!
Link to comment
https://www.neowin.net/forum/topic/616815-ms-dos-batch-automatically-determine-if-drive-is-already-mapped/Share on other sites
19 answers to this question
Recommended Posts