Ethereal-dev: [Ethereal-dev] Re: Re: [Ethereal-users] timestamp problem

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

Date: Fri, 30 Jan 2004 20:53:11 +0000

Martin Regner wrote:
>J Fielding wrrote:
>>
>> It's only in bat files that % is treated specially, when you must say %%

>> to mean the % char. So a batch file to text2pcap <name>.txt to <name>.eth
>> might say:

>When I use % on my Windows 98 Swedish Edition from command line I get the

>problem - but not on Windows 2000, so it's not only related to bat-files.

I did a few tests and it looks like this is what Windows does with % on the command line: In all versions tested, if the line contains %any text% look for environment variable ANY TEXT, replace with expansion if found. If not found, NT restores the original text but OT does not.
Tested with:
NT: WinNT4, Win2k
OT: Win95 (and Martin's previous Win98 tests were effectively the same)
Typical test: echo %test%junk

The %% work-around does work on Win95, so echo %%path%% gives %path%. It doesn't work on WinNT - it gives %expansion of PATH%.

So in dos/windows % is treated specially in bat files. And in command lines (inconsistently). And in the "for" command. And in the command lines in Windows shortcuts. And in whatever else I forgot . . .

It is therefore a good idea to not require the use of % in any program's command line arguments.

Julian.