locked
I have an application where I need to change the database folder depends on the first 3 letters of machine name? RRS feed

Answers

  • You could do something like this:

    @ECHO OFF
    GOTO %COMPUTERNAME:~0,3%
    
    :HAC
    [commands to set option to \\hacssfs001\apps\WoodMac\GlobalEconomicModel\GEM
    GOTO :EOF
    
    :NYC
    [commands to set option to \\nycssfs002\apps\WoodMac\GlobalEconomicModel\GEM]
    GOTO :EOF
    
    :WDB
    [commands to set option to \\nycssfs002\apps\WoodMac\GlobalEconomicModel\GEM]
    GOTO :EOF
    
    :LOS
    [commands to set option to \\losssfs002\applications\WoodMac\GlobalEconomicModel\GEM]
    GOTO :EOF
    
    :KUL
    [commands to set option to \\kulssfs001\applications\WoodMac\GlobalEconomicModel\GEM]
    GOTO :EOF
    
    :BKK
    [commands to set option to \\kulssfs001\applications\WoodMac\GlobalEconomicModel\GEM]
    GOTO :EOF
    
    :JAK
    [commands to set option to \\jakssfs001\applications\WoodMac\GlobalEconomicModel\GEM]
    GOTO :EOF
    
    :BEJ
    [commands to set option to \\bejssfsgenp01\applications\WoodMac\GlobalEconomicModel\GEM]
    GOTO :EOF



    Please remember to click "Mark as Answer" or "Vote as Helpful" on the post that answers your question (or click "Unmark as Answer" if a marked post does not actually answer your question). This can be beneficial to other community members reading the thread.


    This forum post is my own opinion and does not necessarily reflect the opinion or view of my employer, Microsoft, its employees, or other MVPs.

    Twitter: @stealthpuppy | Blog: stealthpuppy.com | The Definitive Guide to Delivering Microsoft Office with App-V



    Tuesday, March 26, 2013 1:13 PM
    Moderator

All replies

  • You could do something like this:

    @ECHO OFF
    GOTO %COMPUTERNAME:~0,3%
    
    :HAC
    [commands to set option to \\hacssfs001\apps\WoodMac\GlobalEconomicModel\GEM
    GOTO :EOF
    
    :NYC
    [commands to set option to \\nycssfs002\apps\WoodMac\GlobalEconomicModel\GEM]
    GOTO :EOF
    
    :WDB
    [commands to set option to \\nycssfs002\apps\WoodMac\GlobalEconomicModel\GEM]
    GOTO :EOF
    
    :LOS
    [commands to set option to \\losssfs002\applications\WoodMac\GlobalEconomicModel\GEM]
    GOTO :EOF
    
    :KUL
    [commands to set option to \\kulssfs001\applications\WoodMac\GlobalEconomicModel\GEM]
    GOTO :EOF
    
    :BKK
    [commands to set option to \\kulssfs001\applications\WoodMac\GlobalEconomicModel\GEM]
    GOTO :EOF
    
    :JAK
    [commands to set option to \\jakssfs001\applications\WoodMac\GlobalEconomicModel\GEM]
    GOTO :EOF
    
    :BEJ
    [commands to set option to \\bejssfsgenp01\applications\WoodMac\GlobalEconomicModel\GEM]
    GOTO :EOF



    Please remember to click "Mark as Answer" or "Vote as Helpful" on the post that answers your question (or click "Unmark as Answer" if a marked post does not actually answer your question). This can be beneficial to other community members reading the thread.


    This forum post is my own opinion and does not necessarily reflect the opinion or view of my employer, Microsoft, its employees, or other MVPs.

    Twitter: @stealthpuppy | Blog: stealthpuppy.com | The Definitive Guide to Delivering Microsoft Office with App-V



    Tuesday, March 26, 2013 1:13 PM
    Moderator
  • Thanks Aaron,

    I don't have basic knowledge on scripting and how to implement that.

    Request you to please help me at this point  of time with where to run this and how to...

    I've a question regarding to the above script,

    The above script will find the computer name and then it'll pass the value depends on the computer name. But, there is nothing mentioned where or to which registry or place it needs to copy the database name.

    Thanks in advance.

    Tuesday, March 26, 2013 3:55 PM
  •  I have no idea where your application stores that information in the registry, so you'll need to find that out first. You can write to the registry with a REG ADD command. Run REG ADD /? from a command prompt to see help on how to use the REG ADD command.


    Please remember to click "Mark as Answer" or "Vote as Helpful" on the post that answers your question (or click "Unmark as Answer" if a marked post does not actually answer your question). This can be beneficial to other community members reading the thread.


    This forum post is my own opinion and does not necessarily reflect the opinion or view of my employer, Microsoft, its employees, or other MVPs.

    Twitter: @stealthpuppy | Blog: stealthpuppy.com | The Definitive Guide to Delivering Microsoft Office with App-V

    Tuesday, March 26, 2013 5:31 PM
    Moderator