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.

Batch - Using Dual Variables

Featured Replies

Hey all,

First of all, you guys are my lifeline and I want to thank you for all of your help in the past!

I am trying to map a network drive, depending on what domain they are on...

I can't figure out how to get the dual variable to work properly, here is what I have:

set D_Domain1=Server1
set D_Domain2=Server2
set D_Domain3=Server3
set Server=%D_%USERDNSDOMAIN%%
net use O: \\%Server%\Share

I know that the %'s are wrong and is what is causing my problem... but I don't know how to fix it.

%USERDNSDOMAIN% is the user's full domain name and I want to set %Server% as D_InsertUsersDomainHere but the Double %%'s are tripping me up.

Any Ideas?

Edited by twig123

There may be other ways to solve this, but this was my first thought:


set D_Domain1=Server1
set D_Domain2=Server2
set D_Domain3=Server3

for /f "tokens=1,* delims==" %%a in ('set D_^|find /i "%USERDNSDOMAIN%"') do set Server=%%b
net use O: \\%Server%\Share

If only I could understand what you are trying to do....

...Where is USERDNSDOMAIN defined?

:w00t:

However maybe this is the missing point, (alternate solution to the one already posted) enabling delayed expansion of variables and use the !var! syntax together with the %var% one, that allows for

!var1_%var2%!

SETLOCAL ENABLEDELAYEDEXPANSION

SET USERDNSDOMAIN=Domain2

set D_Domain1=Server1
set D_Domain2=Server2
set D_Domain3=Server3
set Server=!D_%USERDNSDOMAIN%!

SET Server
PAUSE
net use O: \\%Server%\Share

jaclaz

  • Author

%USERDNSDOMAIN% is a system wide variable that is set by windows if a computer is joined to a Domain.

I was trying to make a new variable out of 2 existing variables to grab the data that was contained within the 3rd variable. Both of your replies seem to accomplish this goal in different ways.

Thanks

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.