home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch      Fun with MS-DOS batch files      42,547 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 41,459 of 42,547   
   T to foxidrive   
   Re: net use question   
   13 Sep 16 12:40:51   
   
   From: T@invalid.invalid   
      
   On 09/13/2016 11:04 AM, foxidrive wrote:   
   > On 14/09/2016 03:33, T wrote:   
   >> On 09/13/2016 03:06 AM, foxidrive wrote:   
   >>> On 13/09/2016 19:50, T wrote:   
   >>>> Hi All,   
   >>>>   
   >>>> I use this command to check if someone is missing the file mount.   
   >>>> I put it in their start up:   
   >>>>   
   >>>> set dr=G   
   >>>> if not exist %dr%:\nul  (   
   >>>>       net use %dr%: \\server\public   
   >>>> ) ELSE (   
   >>>> echo %dr%: is already mounted   
   >>>> )   
   >>>>   
   >>>> Works fine.  Problem.  I mount several drives this way.   
   >>>> Not everyone is allowed in every drive (depends on their   
   >>>> group assignments in Samba).   
   >>>>   
   >>>> If they try to mount a drive they are  not allow in, the   
   >>>> line stops with a question.  Not something the user can   
   >>>> handle in a start up script.   
   >>>>   
   >>>> Is there any way to cancel the "net use" if the user is   
   >>>> not allowed in?   
   >>>>   
   >>>> I am thinking of doing a "net use * \\server" to see   
   >>>> everything and then pick out what shows, but this is   
   >>>> a pain in the butt with batch script.   
   >>>>   
   >>>> Many thanks,   
   >>>> -T   
   >>>>   
   >>>   
   >>> Is this useful?  If it finds the text it will run your code.   
   >>> Use || instead of && to run the code if it doesn't find the text.   
   >>>   
   >>>   
   >>> set dr=G   
   >>> net use * \\server|find /i "text to search for" >nul && (   
   >>>  if not exist %dr%:\nul  (   
   >>>        net use %dr%: \\server\public   
   >>>  ) ELSE (   
   >>>  echo %dr%: is already mounted   
   >>>  ))   
   >>   
   >> Thank you, I will check it out!   
   >>   
   >> What does || do?   
   >>   
   >   
   > Conditional execution.   
   >   
   > A recent post of mine in your thread on 1 September describes it.   
   > "Any method of getting uuid's of unmounted drives?"   
   >   
   >   
      
   Found it.  Thank you!   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca