Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Automatically connecting netwoork drive

Featured Replies

Hi there,

I'm trying to connect automatically to a network share in a batch file. Til now I used the following method to find the first free drive letter:

for %%a in (l m n o p q r) do (
fsutil fsinfo drivetype %%a:|find "No such Root Directory">nul 2>&1&&call :check %%a:
)
:check
if not defined drvlet set drvlet=%1&goto :eof

But now I want to make it independent from the system language and so I tried something with "net use * \\ server\share", so that the first free drive letter is automatically taken to connect to. Problem is to get the first drive letter into a variable. For now I have the following

For /f "usebackq tokens=2*" %%i IN (`net use * \\server\share`) DO (
echo %%i)

Now I've got the problem to get the drive letter into a variable. So is there any way to use wildcards in an IF statement ( every opinion I found til now, means no ) or how do I get the drive letter in another way into a variable?


  • Author

Just found out for myself:

set share=\\server\share

FOR /f "usebackq tokens=2* eol=" %%i IN (`net use * %share% /PERSISTENT:NO`) DO (

SET drvlet=%%i

GOTO endfor

)

:endfor

[\code]

Connects to the "last" free drive letter, means that windows searches for free driveletters backwards and those letters to which a local device was assigned anytime ago, are left out for the first.

Should be system-language independent.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.