Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Amazon Web Services (AWS)

Jun
13
1
I've been trying to use the command line interface to AWS supplied by Amazon, with little success. It is provided as a library of .cmd files (and other files used by the .cmd scripts). These scripts almost universally produce error messages with TakeCommand (and TCC) but work fine with the standard Windows command processor. I assume there's a level of SETDOS that will make them work, but I haven't had time to work through the testing required.

Has anyone here had some experience with this service and how to make it work under TakeCommand?
 
I don't have direct experience but under options tcc look for the check box that's labeled Duplicate cmd bugs.

Sent from my Droid Incredible Verizon Wireless phone

----- Reply message -----
From: "bwawsc2" <>
Date: Fri, Jan 21, 2011 11:29 am
Subject: [Support-t-2544] Amazon Web Services (AWS)
To: <[email protected]>

I've been trying to use the command line interface to AWS supplied by Amazon, with little success. It is provided as a library of .cmd files (and other files used by the .cmd scripts). These scripts almost universally produce error messages with TakeCommand (and TCC) but work fine with the standard Windows command processor. I assume there's a level of SETDOS that will make them work, but I haven't had time to work through the testing required.

Has anyone here had some experience with this service and how to make it work under TakeCommand?
 
I went to the http://aws.amazon.com
web site and was quickly overwhelmed with choices. What do I need
to download to replicate your issue?

-Scott

bwawsc2 <> wrote on 01/21/2011
11:29:25 AM:


> bwawsc2 <>
> 01/21/2011 11:29 AM
>
> Please respond to
>
>
> To
>
> [email protected]
>
> cc
>
> Subject
>
> [Support-t-2544] Amazon Web Services (AWS)
>
> I've been trying to use the command line interface to AWS supplied


> by Amazon, with little success. It is provided as a library
of .cmd

> files (and other files used by the .cmd scripts). These scripts


> almost universally produce error messages with TakeCommand (and TCC)
> but work fine with the standard Windows command processor. I
assume

> there's a level of SETDOS that will make them work, but I haven't


> had time to work through the testing required.
>
> Has anyone here had some experience with this service and how to
> make it work under TakeCommand?
>
>
>
>
 
I went to the http://aws.amazon.com
web site and was quickly overwhelmed with choices. What do I need
to download to replicate your issue?

-Scott
Boy, that's ambitious. :) Here's the "Getting Started Guide" for an example cli:

http://awsdocs.s3.amazonaws.com/IAM/latest/iam-gsg.pdf

It calls for downloading this zip file:

http://aws.amazon.com/developertools/AWS-Identity-and-Access-Management/4143

You can't do anything useful with it unless you have an Amazon account and have applied for access to their Web Services, but you can probably at least reproduce the error messages.
 
I don't have direct experience but under options tcc look for the check box that's labeled Duplicate cmd bugs.

Sent from my Droid Incredible Verizon Wireless phone
<[email protected]>
Just for the record, this didn't do it.

Here's an example of a statement within one of the .cmd files that causes an error in TakeCommand but not in CMD.exe:

</[email protected]>
if "%CHK_HOME:"=%" == "_" goto HOME_MISSING
 
I downloaded the ZIP file and looked at iam-cmd.cmd.

The file uses the CMD syntax for string substitution: %variable:str1=str2%

That syntax replaces all occurrences of str1 with str2 within variable.
The specific syntax in the iam-cmd.cmd file is:

if "%CHK_AWS_IAM_HOME:"=%" == "_" goto AWS_IAM_HOME_MISSING
if "%CHK_JAVA_HOME:"=%" == "_" goto JAVA_HOME_MISSING
...
"%JAVA_HOME:"=%\bin\java" %AWS_IAM_JVM_OPTS% -classpath "%CP%"
com.amazonaws.services.auth.identity.cli.view.%CMD% %ARGV%

Since str2 is allowed to be empty, that effectively means remove all
occurrences of str1, or in the above examples, remove the double quotes.
When I run the above file, I get errors on those two IF statements when
run from TCC.

C:\Temp\wzd7b7\IAMCli-1.1.0\bin\iam-cmd.cmd [19] Usage : IF [/I] [NOT]
condition [.AND. | .OR. | .XOR. [NOT] condition ...] command
C:\Temp\wzd7b7\IAMCli-1.1.0\bin\iam-cmd.cmd [20] Usage : IF [/I] [NOT]
condition [.AND. | .OR. | .XOR. [NOT] condition ...] command

Turning on DuplicateBugs makes no difference.

-Scott

bwawsc2 <> wrote on 01/21/2011 03:26:24 PM:


> bwawsc2 <>
> 01/21/2011 03:26 PM
>
> Please respond to
>
>
> To
>
> [email protected]
>
> cc
>
> Subject
>
> RE: [Support-t-2544] Re: Amazon Web Services (AWS)
>
> ---Quote (Originally by samintz)---
> I went to the http://aws.amazon.com
> web site and was quickly overwhelmed with choices. What do I need
> to download to replicate your issue?
>
> -Scott
> ---End Quote---
> Boy, that's ambitious. Here's the "Getting Started Guide" for an
example cli:

>
> http://awsdocs.s3.amazonaws.com/IAM/latest/iam-gsg.pdf
>
> It calls for downloading this zip file:
>
>
http://aws.amazon.com/developertools/AWS-Identity-and-Access-Management/4143


>
> You can't do anything useful with it unless you have an Amazon
> account and have applied for access to their Web Services, but you
> can probably at least reproduce the error messages.
>
>
>
>
 
Here's an example of a statement within one of the .cmd files that causes an error in TakeCommand but not in CMD.exe:

</[email protected]>

There's a LOT of problems in those scripts -- starting with Amazon apparently not knowing that Windows uses CR/LF for EOLs, and continuing to the illegal / undocumented syntax they're using for variable substitution.

Some of this I may be able to hack around; I'll poke into it a bit.
 
According to CMD /C SET /? the syntax is documented. Which part of the
syntax is illegal/undocumented?

Environment variable substitution has been enhanced as follows:

%PATH:str1=str2%

would expand the PATH environment variable, substituting each occurrence
of "str1" in the expanded result with "str2". "str2" can be the empty
string to effectively delete all occurrences of "str1" from the expanded
output. "str1" can begin with an asterisk, in which case it will match
everything from the beginning of the expanded output to the first
occurrence of the remaining portion of str1.

May also specify substrings for an expansion.

%PATH:~10,5%

would expand the PATH environment variable, and then use only the 5
characters that begin at the 11th (offset 10) character of the expanded
result. If the length is not specified, then it defaults to the
remainder of the variable value. If either number (offset or length) is
negative, then the number used is the length of the environment variable
value added to the offset or length specified.

%PATH:~-10%

would extract the last 10 characters of the PATH variable.

%PATH:~0,-2%

would extract all but the last 2 characters of the PATH variable.

-Scott

rconn <> wrote on 01/21/2011 04:36:57 PM:


>
> continuing to the illegal / undocumented syntax they're using for
> variable substitution.
>
>
>
 
I downloaded the ZIP file and looked at iam-cmd.cmd.

The file uses the CMD syntax for string substitution: %variable:str1=str2%

That syntax replaces all occurrences of str1 with str2 within variable.
The specific syntax in the iam-cmd.cmd file is:

if "%CHK_AWS_IAM_HOME:"=%" == "_" goto AWS_IAM_HOME_MISSING
if "%CHK_JAVA_HOME:"=%" == "_" goto JAVA_HOME_MISSING
...
"%JAVA_HOME:"=%\bin\java" %AWS_IAM_JVM_OPTS% -classpath "%CP%"
com.amazonaws.services.auth.identity.cli.view.%CMD% %ARGV%

Since str2 is allowed to be empty, that effectively means remove all
occurrences of str1, or in the above examples, remove the double quotes.
When I run the above file, I get errors on those two IF statements when
run from TCC.

C:\Temp\wzd7b7\IAMCli-1.1.0\bin\iam-cmd.cmd [19] Usage : IF [/I] [NOT]
condition [.AND. | .OR. | .XOR. [NOT] condition ...] command
C:\Temp\wzd7b7\IAMCli-1.1.0\bin\iam-cmd.cmd [20] Usage : IF [/I] [NOT]
condition [.AND. | .OR. | .XOR. [NOT] condition ...] command

Turning on DuplicateBugs makes no difference.

-Scott
This agrees with my observation and with their stated intention (from some notes somewhere that I can't find anymore) to strip quotes from variables. Why they don't use CR/LF <cr><lf> in native Windows files I don't know. I see this a lot from people who are basically Unix users porting their stuff to Windows. Windows seems to handle it ok, but it makes most files unreadable by humans.</lf></cr>
 
According to CMD /C SET /? the syntax is documented. Which part of the syntax is illegal/undocumented?

Embedding a double quote as a variable name character.

They can get away with this in CMD because it requires a leading and trailing %, and assumes that everything between them must be a valid character (including spaces, tabs, quotes, etc.). There's no way to allow this in TCC without requiring everybody to change their aliases & batch files from a single leading % to always use the CMD variable name syntax.
 
These scripts almost universally produce error messages with TakeCommand (and TCC) but work fine with the standard Windows command processor
Forgive me for stating the bleeding obvious, but why not let CMD.EXE execute those scripts then?? Personally I've always set up 4DOS/4OS2/4NT/Take Command et al so that they execute .BTM files whilst .CMD and .BAT files are left for the OS to handle in the usual way. Whilst there may be benefits to having TC execute everything, in general the various compatability issues make that more trouble than its worth.
 
Forgive me for stating the bleeding obvious, but why not let CMD.EXE execute those scripts then?? Personally I've always set up 4DOS/4OS2/4NT/Take Command et al so that they execute .BTM files whilst .CMD and .BAT files are left for the OS to handle in the usual way. Whilst there may be benefits to having TC execute everything, in general the various compatability issues make that more trouble than its worth.
Primarily because I hate the limitations of cmd.exe and don't like working within it. The other answer is that I'm a beta tester at heart and can't help raising compatibility issues whenever I encounter them. And this sounds like an oversight on Rex's part - he overlooked a feature of the command syntax in cmd.exe and I'm sure he will want to fix it - even if not as a high priority.
 
Primarily because I hate the limitations of cmd.exe and don't like working within it
Fair enough, and I'm not suggesting that you ever work within it (I try to avoid that too) just let it execute scripts designed to run under it.

this sounds like an oversight on Rex's part - he overlooked a feature of the command syntax in cmd.exe and I'm sure he will want to fix it
I'm not sure that that is entirely true but I'd certainly like to disagree with the sentiment. There has been a long-time dichotomy between those of us that would prefer Rex's product to stay true to its own roots and only support CMD's way of doing things if they don't break the consistency of the existing product and those that would prefer CMD compatability at all costs. I fall into the former group, since I've been using them pretty much as long as I've been using the operating systems on which they run/ran (dating back to the mid 90s) and have always avoided the built-in command line processors.
 
The other thing to keep in mind is that
while you may have associated .BAT and .CMD with CMD.EXE, if you execute
one of those scripts from a TCC prompt, then TCC will execute them and
not CMD. Only if you launch those scripts from Explorer or some other
non-TCC process will CMD execute them.

And if those scripts modify the environment,
like vcvars32.bat for example, then executing them in a separate process
loses all those mods. So there is definitely a use case for wanting
those scripts to run correctly in a TCC process.

I experimented a little a while ago
with PATHEXT and created a wrapper for executing BAT files in CMD within
TCC. I'll see if I can find what I did with it. It may even
be in this forum somewhere.

-Scott

bwawsc2 <> wrote on 01/25/2011
05:44:09 PM:


> ---Quote (Originally by Steve Pitts)---
> Forgive me for stating the bleeding obvious, but why not let CMD.EXE
> execute those scripts then?? Personally I've always set up 4DOS/
> 4OS2/4NT/Take Command et al so that they execute .BTM files whilst


> .CMD and .BAT files are left for the OS to handle in the usual way.


> Whilst there may be benefits to having TC execute everything, in
> general the various compatability issues make that more trouble thanits
worth.

> ---End Quote---
>
>
>
 

Similar threads

Back
Top