delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/05/14/08:51:22

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <4285F43B.70604@familiehaase.de>
Date: Sat, 14 May 2005 14:51:07 +0200
From: "Gerrit P. Haase" <gerrit AT familiehaase DOT de>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.7) Gecko/20050414
MIME-Version: 1.0
To: Natxo Asenjo <natxo DOT asenjo AT gmail DOT com>
CC: cygwin AT cygwin DOT com
Subject: Re: date.exe problem
References: <90f6e8270505140524314bf23b AT mail DOT gmail DOT com>
In-Reply-To: <90f6e8270505140524314bf23b@mail.gmail.com>
X-IsSubscribed: yes

Natxo Asenjo wrote:
> Hi,
> 
> I would like to use the cygwin tools in batch files, to extend the
> poor shell windows has. My shell is cmd.exe for xp pro. Ok.
> 
> One thing that is not working as should is 'date'. As I understand
> from the faq, one can use full paths to executables in cmd.exe, that
> works fine interactively. Now the problem is this. I declare a %hour%
> variable in a batch file
> 
> set hour=c:\cygwin\bin\date.exe
> 
> if I then do:
> 
> %date% +%H-%M
> 
> that works as expected (interactively). But, if I use that in the
> batch file, then it gives me "H" instead of the hour. It ommits the
> '%' , does not interpret it and does not work. I am not sure if this
> is a dos problem (my understanding of this is not very good, I am
> afraid).
> 
> Thanks in advance,
> 

In cmd (scripts) the % is reserved: 
http://labmice.techtarget.com/articles/batchcmds.htm#variable:
Try this instead:
c:\cygwin\bin\date +%%H-%%M


Gerrit
-- 
=^..^=

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019