Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6086725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:47:19+00:00 2026-05-23T11:47:19+00:00

I have this in my profile script. $AddablePaths = @{ python3=;C:\Python32; python2=;C:\Python27; D=;C:\D\dmd2\windows\bin; gcc=;C:\MinGW\bin;

  • 0

I have this in my profile script.

$AddablePaths = @{
    "python3"=";C:\Python32";
    "python2"=";C:\Python27";
    "D"=";C:\D\dmd2\windows\bin";
    "gcc"=";C:\MinGW\bin";
    "verge"=";C:\Users\Cold\Dev\Verge\tools";
    "ruby"=";C:\Ruby192\bin";
    "git"=";C:\Program Files\Git\cmd";
    "cmake"=";C:\Program Files\CMake 2.8\bin";
    "emacs"=";C:\Users\Cold\Dev\emacs\bin";
    "notepad++"=";C:\Program Files\Notepad++";
    "boost-build"=";C:\Users\Cold\Dev\C++\boost-build\bin";
    "svn"=";C:\Program FIles\SlikSvn\bin";
    "gtk2"=";C:\Program Files\GTK2-Runtime\bin";
    "qt"=";C:\Qt\bin";
    "komodo"=";C:\Program Files\ActiveState Komodo Edit 6\";
    "hg"=";C:\Program Files\TortoiseHg\"
}

$AddedPaths = @()

function AddPath($keys)
{
    if ($keys.Count -eq 0) { return }

    foreach ($key in $keys)
    {
        if ($AddablePaths.Contains($key))
        {
            if (!($AddedPaths -contains $key))
            {
                $env:Path += $AddablePaths[$key]
                $AddedPaths += $key
            }
        }
        else
        {
            Write-Host "Invalid path option. Options are:"
            foreach ($key in $AddablePaths.keys) {
                Write "    $key"
            }
        }
    }
}

It’s purpose is to allow me to be able to easily add to my path only the things that I need. For example, I can call AddPath("ruby","git","notepad++") to add those three things to my path. I want that it doesn’t add items if I already added them, so I created the $AddedPaths array to keep track of what’s been added already. However, it doesn’t update when I call the function, so duplicates can still be added. What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:47:20+00:00Added an answer on May 23, 2026 at 11:47 am

    You’ll need to do this:

    $Global:AddedPathes += $key
    

    That should be the only place you need $Global: since it modifies it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hy! Here is my problem: i have a profile and this profile has for
i would like a simple help... i have a url like this: example.com/profile.php?id= &
This is something that I have always wondered about, but never bothered to profile.
I have a page, URI looks like this: http://domain.example.com/Profiles/Profile.aspx?username=blah#blahtab When that fragment (#blahtab) is
I have written a custom shell script function, and put in in my .profile
I have the following snippet of PowerShell script in my profile: . (join-path (split-path
I have a bash script mysql_cron.sh that runs mysqldump #!/bin/bash /usr/local/mysql/bin/mysqldump -ujoe -ppassword >
I have the following script: $("tr.member_profile_comment_row_frame").mouseover(function () { $(this.element."img.member_profile_comment_show_delete_button").show(); }); $("tr.member_profile_comment_row_frame").mouseout(function () { $(this.element."img.member_profile_comment_show_delete_button").hide();
I have a top script displaying a list of users (will turn this script
I have this ajax_update script that updates file.php every 60 seconds.. Now file.php outputs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.