Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 


Sign in to follow this  
MarcoTips

installation depending on username

Recommended Posts

is there some way? perhaps a script that reads the username or the name the computer is registered too and then decides if the name equals perhaps A, B or C, to install the app, if the name is D then it exits the script

Share this post


Link to post
Share on other sites

sure. you can specify an If Then statement in a batch file. i haven't done it before, but i know that it can be done. search google for batch file information.

Share this post


Link to post
Share on other sites

Example below maybe suitable?

If %username% = 'A' then goto NameA
If %username% = 'B' then goto NameB
If %username% = 'C' then goto NameC
If %username% = 'D' then goto End

:NameA
setup.exe
exit

:NameB
setup.exe
exit

:NameC
setup.exe
exit

:End
exit

Share this post


Link to post
Share on other sites

I'm not sure what language you wrote that example in, but if it's supposed to be a batch file, then it's wrong :)

IF "%UserName%" == "A" GOTO NameA
IF "%UserName%" == "B" GOTO NameB
IF "%UserName%" == "C" GOTO NameC
IF "%UserName%" == "D" GOTO End

:NameA
setup.exe
EXIT

:NameB
setup.exe
EXIT

:NameC
setup.exe
EXIT

:End
EXIT

Share this post


Link to post
Share on other sites
IF "%UserName%" == "A" GOTO NameA
IF "%UserName%" == "B" GOTO NameB
IF "%UserName%" == "C" GOTO NameC
EXIT

:NameA
setup.exe
EXIT

:NameB
setup.exe
EXIT

:NameC
setup.exe
EXIT

Share this post


Link to post
Share on other sites
but what should I use to get the computername

The answer is in the question

%ComputerName%

:)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...