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

using UNC paths in batch files


  • Please log in to reply
4 replies to this topic

#1 EddieMonsoon

EddieMonsoon

  • Members
  • 9 posts
  • OFFLINE
  •  
  • Local time:12:33 PM

Posted 30 April 2015 - 11:04 AM

I do a weekly program on a community radio station, and I want to automate the loading of my music and playlist files onto the station server.

 

Specifically I'm thinking of writing a batch file that will a) Create a directory on the station's music server; load my music and playlist files into it, so that I can integrate my program materials with the station's automation system; c) transfer changed files and log files back to my thumb drive and remove the directory and its contents from the server at the end of my airshift.

 

I think I can manage most of that if not for the problem of using UNC paths in CMD.exe.  (The radio station's computers run Windows 8.  I use XP at home). 

Is there a work-around?  Can I for example, invoke MOUNTVOL or SUBST from within the batch file, to create a temporary drive or directory pointing to the network path?



BC AdBot (Login to Remove)

 


#2 Kilroy

Kilroy

  • BC Advisor
  • 3,391 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Launderdale, MN
  • Local time:08:33 PM

Posted 30 April 2015 - 08:47 PM

Can you map the drive?

 

NET USE T: "\\SERVER NAME\Share Name" /user:USERNAME PASSWORD



#3 EddieMonsoon

EddieMonsoon
  • Topic Starter

  • Members
  • 9 posts
  • OFFLINE
  •  
  • Local time:12:33 PM

Posted 01 May 2015 - 02:50 AM

I can map a drive manually using Windows Explorer or my own file manager (FreeCommander), if that's what you mean.

 

I will try

NET USE T: "\\SERVER NAME\Share Name" /user:USERNAME PASSWORD

in my batch file (with appropriate substitutions).

Thanks.



#4 Kilroy

Kilroy

  • BC Advisor
  • 3,391 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Launderdale, MN
  • Local time:08:33 PM

Posted 01 May 2015 - 04:17 PM

If you have issues post as much as you can and I'll see what I can recommend to resolve any issues you may be having.



#5 drwmbt

drwmbt

  • Members
  • 98 posts
  • OFFLINE
  •  
  • Local time:08:33 PM

Posted 03 May 2015 - 12:21 PM

instead of mapping the drives you can do a temporary "map" by using the pushd and pop commands,

 

pushd \\unc\path\to\directory

 

http://ss64.com/nt/pushd.html

 

in fact, according to your needs the pushd command is precisely what you need since it sets up the map automatically and also completely from within the command line, then simply typing pop into the cmd line after your segment ends, will clear all the settings readying and clearing the system out for the next user.


Edited by drwmbt, 03 May 2015 - 12:22 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users