Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Batch File


  • Please log in to reply
5 replies to this topic

#1 djmiiller

djmiiller

  • Members
  • 27 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Missouri
  • Local time:05:25 PM

Posted 02 October 2014 - 03:14 PM

Does anyone Know how to open a network drive and then close it right after opening it using a batch file. Im having a bit of trouble. Any help would be greatly appreciated.

 

Thanks

DJ



BC AdBot (Login to Remove)

 


#2 Billy O'Neal

Billy O'Neal

    Visual C++ STL Maintainer


  • Malware Response Team
  • 12,304 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Redmond, Washington
  • Local time:03:25 PM

Posted 02 October 2014 - 03:19 PM

Are you aware of the net use command?

Have you considered PowerShell instead?

Billy3
Twitter - My statements do not establish the official position of Microsoft Corporation, and are my own personal opinion. (But you already knew that, right?)
Posted Image

#3 djmiiller

djmiiller
  • Topic Starter

  • Members
  • 27 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Missouri
  • Local time:05:25 PM

Posted 02 October 2014 - 03:21 PM

No, not really just started using batch files for my job so I don't know much of it. I also have not considered using powershell.



#4 djmiiller

djmiiller
  • Topic Starter

  • Members
  • 27 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Missouri
  • Local time:05:25 PM

Posted 02 October 2014 - 03:28 PM

I have talked to my boss and no we aren't able to use powershell.



#5 Billy O'Neal

Billy O'Neal

    Visual C++ STL Maintainer


  • Malware Response Team
  • 12,304 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Redmond, Washington
  • Local time:03:25 PM

Posted 02 October 2014 - 03:47 PM

Ok, then look at the net use command :)

Billy3
Twitter - My statements do not establish the official position of Microsoft Corporation, and are my own personal opinion. (But you already knew that, right?)
Posted Image

#6 JohnnyJammer

JohnnyJammer

  • Members
  • 1,117 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:QLD Australia
  • Local time:08:25 AM

Posted 02 October 2014 - 06:42 PM

Just use the net use like billy said.

Y being the drive letter to use so change that to suit. make sure its under the Scripts/LogOn event in group policy.

@echo off
net use Y:\\someserver\somefolder
exit

PS: I thought you could rename the drive letter with wmic but doesnt appear to be the case with mapped drives. I tried the following

wmic where deviceid="Y:" set volumename="Files" /nointeractive

But that didnt work. You might have to add a registry string to write the value of the Name you would like to display in Explorer mate.


Edited by JohnnyJammer, 02 October 2014 - 06:56 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users