Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like to run a bunch of .CMD files from anywhere on my server. However, when I add the path that these files are in to my PATH in System Environment Variables, they don't run. I can run them if I go to the actual folder, however.

I am trying to make the following directory globally accessible:

C:\Amazon\IAMCli-1.5.0\bin\

AWS_IAM_HOME is set to:

C:\Amazon\IAMCli-1.5.0

My PATHEXT profile is as such:

.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

If I run my Path command, I get the following reply:

PATH=C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files\Dell\DW WLAN Card;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Dell\Dell Data Protection\Access\Advanced\Wave\Gemalto\Access Client\v5\;C:\Program Files (x86)\NTRU Cryptosystems\NTRU TCG Software Stack\bin\;C:\Program Files\NTRU Cryptosystems\NTRU TCG Software Stack\bin\;C:\Program Files (x86)\Windows Live\Shared;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\OpenSSL\bin;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files (x86)\Git\cmd;C:\Program Files\Microsoft\Web Platform Installer\;C:\Users\Peter\AppData\Roaming\npm;C:\Program Files (x86)\nodejs\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\; C:\Amazon\IAMCli-1.5.0\bin\; C:\Amazon\ElasticLoadBalancing-1.0.17.0\bin\; C:\Amazon\AutoScaling-1.0.61.1\bin\; C:\OpenSSL\bin\;

I am trying to run the following .CMD file globally by issuing

C:\Amazon\IAMCli-1.5.0\bin\iam-userlistbypath.cmd

I am logged in as a non-admin user by have verified that if I run the Command prompt as admin, I get the same result. The permissions for the folder

C:\Amazon\IAMCli-1.5.0

are:

Authenticated Users (Modify, Read & Execute, List folder contents, Read, Write) 
SYSTEM (Full control) 
Administrators (Full control) 
Users (Read & Execute, List folder contents, Read)

Any ideas?

Thanks.

share|improve this question
1  
Add some details about what you actually have done. What is the actual path to the files? If you do an echo %PATH% in your terminal do you see the path you expect including that directory? –  Zoredache Jan 25 '13 at 19:39
    
Hi Zoredache, details provided. Please let me know if I have missed anything. Thanks for your help. –  Code Sherpa Jan 25 '13 at 20:28
    
Can you test this with as short a path as possible, such as %systemroot%\system32;and the path of one of your applications? –  Greg Askew Jan 25 '13 at 23:39

2 Answers 2

I see spaces on the C:\Amazon entries. Try removing those first. If it's comma-delimited, the spaces might change the PATH from "C:\Amazon..." to " C:\Amazon..." which can be entirely different.

share|improve this answer

You state that you're logged in as non-admin. The issue sounds similar to this question:

Environment Variables in PATH Not Expanded for non-Admin Command Prompt?

share|improve this answer
    
Hi George. I was wondering if it was a permissions issue also. However, when I log into my CMD prompt as Admin, i still have the same problem. If I run my command at C:\, it says the command is not recognized. However, if I run the same command at C:\Amazon\IAMCli-1.5.0\bin, it runs. It doesn't seem to matter if I am admin or not. –  Code Sherpa Jan 25 '13 at 20:48
    
OK what do you get when you type: Echo %PATH% path.txt | find "C:\Amazon\IAMCli-1.5.0\bin" path.txt (trying to ensure there's no typos in the PATH variable) ? –  George Erhard Jan 25 '13 at 20:50
    
I'll ask the obvious here, you've stored your CMD files as well as the programs they call in the bin folder, yes? I know... of course you did. Just thinking that if either the CMD's or the stuff they use aren't in the path you'd see what you're seeing. I did a little test on my 2008 r2 server, created a new folder off the root, added that folder to the path, and wrote a two line test.cmd to that folder ("@echo off" and then "echo testing!"). The test executed from outside the folder. –  George Erhard Jan 25 '13 at 20:59
    
Well, it is a straight download from AWS. I haven't moved anything from the BIN folder. So, each and every CMD file has an associated file by a similar name. –  Code Sherpa Jan 25 '13 at 21:01
    
OK. can you invoke those files from your command prompt? Say, by typing program-name /? –  George Erhard Jan 25 '13 at 21:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.