4

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.

Peter
  • 163
  • 5
  • 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. – Peter 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 Answers2

1

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.

Insomnia
  • 507
  • 4
  • 10
0

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?

George Erhard
  • 804
  • 6
  • 12
  • 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. – Peter 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. – Peter 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
  • Yes, absolutely. But, as stated above, only in the containing folder. – Peter Jan 25 '13 at 21:03
  • This might be of some help. [link]http://serverfault.com/questions/300544/environment-variables-in-path-not-expanded-for-non-admin-command-prompt – George Erhard Jan 25 '13 at 21:04
  • OK, thanks again George. The scan is running now - I'll let you know if that helps. Thanks much. – Peter Jan 25 '13 at 21:21