Search found 470 matches

by Liviu
05 Feb 2015 22:00
Forum: DOS Batch Forum
Topic: Extreme programming - Coding binary through ECHO
Replies: 13
Views: 4299

Re: Extreme programming - Coding binary through ECHO

I tried the control @ and ALT-256 in notepad and edit and my text editor before I asked my question and I couldn't get the result you have, in Windows 8.1 here Ctrl-@ (or simply Ctrl-2 on a us-en keyboard) works here in "copy con testfile" from at least xp upwards, including x64 win7 and ...
by Liviu
26 Jan 2015 13:14
Forum: DOS Batch Forum
Topic: How to differentiate directory vs file in loop
Replies: 21
Views: 4609

Re: How to differentiate directory vs file in loop

A folder may have other attributes set, such as ReadOnly or Archive. So the string may not be "d--------" C:\temp>for %v in ("%cd%") do @if "%~av" geq "d" (echo it's a directory) else if "%~av" geq "-" (echo it's a file) else (echo no such...
by Liviu
25 Jan 2015 20:16
Forum: DOS Batch Forum
Topic: Dir undocumented wildcards
Replies: 29
Views: 21251

Re: Dir undocumented wildcards

The underlying file system (NTFS, FAT12/16, ...) and the Win32 file API both have definitions of how a filename is defined. The file systems (only) define a filename as a base file name with an optional extension. The Win32 file API is written as common as possible, so it also allows nearly any non...
by Liviu
25 Jan 2015 00:37
Forum: DOS Batch Forum
Topic: Dir undocumented wildcards
Replies: 29
Views: 21251

Re: Dir undocumented wildcards

The tests that I ran indicate a name like ".bat" is an extension: You wouldn't be the only one, as I pointed already. However, copy that ".bat" file to a plain FAT drive, then try run it from there - the SFN will have no extension, and will fail to execute. In other words, the l...
by Liviu
24 Jan 2015 23:35
Forum: DOS Batch Forum
Topic: Dir undocumented wildcards
Replies: 29
Views: 21251

Re: Dir undocumented wildcards

There is one exception: If the name consists solely of an extension, without a base name (...) Just to nitpick, since it's pretty obvious what you meant in the context, but there is no such thing as a pathname that "consists solely of an extension, without a base name" . Technically, a fi...
by Liviu
16 Jan 2015 01:08
Forum: DOS Batch Forum
Topic: Using Alternate Data Streams (in hybrid scripts)
Replies: 4
Views: 3549

Re: Using Alternate Data Streams (in hybrid scripts)

That is, control characters are allowed in stream names! Interesting, thanks for the pointer. An application very well suited to Alternate Data Streams is a Batch-file based hybrid script that include source code for other languages. I dabbled in ADS for scripting some time ago (http://www.dostips....
by Liviu
30 Dec 2014 11:24
Forum: DOS Batch Forum
Topic: if defined over variable with spaces
Replies: 4
Views: 1339

Re: if defined over variable with spaces

Parsing the command line is correct, but the "if" command ends the detection of the environment variables name at the first whitespace. This looks to be the case, indeed, except it's not just whitespace, but any delimiter. The same happens with "if defined var^,etc", "if de...
by Liviu
27 Dec 2014 13:19
Forum: DOS Batch Forum
Topic: Command messages/prompts in various languages
Replies: 8
Views: 2118

Re: Command messages/prompts in various languages

The MUI extension and the <language-code> subdirectories (like 'en-us') are a convention introduced in Vista (see for example http://msdn.microsoft.com/en-us/goglobal/cc442492.aspx#MUI ), with some support built into Windows (GetFileMUIPath and other APIs). However, the technique itself of isolating...
by Liviu
27 Dec 2014 01:46
Forum: DOS Batch Forum
Topic: All I Want for Christmas…
Replies: 3
Views: 1458

Re: All I Want for Christmas…

What @foxidrive said. It's been 12+ years since I liquidated my floppy archive and, among those that I imaged/saved at the time, I found a few that were no longer readable. Also, back in the times of Win 3.x, OEMs took liberties with the distribution. I still have 6-disk Win 3.1 (images), and 8-disk...
by Liviu
26 Dec 2014 20:00
Forum: DOS Batch Forum
Topic: Command messages/prompts in various languages
Replies: 8
Views: 2118

Re: Command messages/prompts in various languages

Does anyone know of a resource that lists standard command prompts and messages for various languages Don't know that such a list exists (not to mention that some texts have changed between versions). And I think it would be a mighty brave endeavor to compile one, but if anyone volunteers then the ...
by Liviu
24 Dec 2014 14:41
Forum: DOS Batch Forum
Topic: Creating a simple batch simulating hitting enter key
Replies: 2
Views: 1175

Re: Creating a simple batch simulating hitting enter key

Or...

Code: Select all

<nul call other.bat
...which runs the secondary batch in the same cmd session so, for example, it can pass environment variables back to the caller.

Liviu
by Liviu
23 Dec 2014 20:44
Forum: DOS Batch Forum
Topic: [Undocumented] Variables __CD__ & __APPDIR__
Replies: 10
Views: 4110

Re: [Undocumented] Variables __CD__ & __APPDIR__

I wonder if there are any more %__var__% variables yet to be discovered It's not a "double-underscore" variable, but NUMBER_OF_PROCESSORS behaves the same way as __CD__ under Win7 (and, I assume, later). Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All ri...
by Liviu
02 Dec 2014 23:16
Forum: DOS Batch Forum
Topic: rd/rmdir and its errorlevel
Replies: 7
Views: 5160

Re: rd/rmdir and its errorlevel

You are right about "del notExist", and think I've seen it before. Yet, that looks to me like a deliberate decision (however questionable) to treat deleting a non-existing file as successful. In contrast, the "rd" behavior looks like a bug particular to "rd". In support...
by Liviu
02 Dec 2014 22:09
Forum: DOS Batch Forum
Topic: rd/rmdir and its errorlevel
Replies: 7
Views: 5160

Re: rd/rmdir and its errorlevel

Interesting find, thanks for sharing. Not sure that the conditional is essential. Consider the following, run at a "cmd /v" prompt. There are no conditionals, and the direct "rd /j" doesn't set the errorlevel, however running it inside a nested "cmd /c" somehow returns ...
by Liviu
08 Oct 2014 18:25
Forum: DOS Batch Forum
Topic: Setlocal/Endlocal commands save/restore current directory!
Replies: 10
Views: 5296

Re: Setlocal/Endlocal commands save/restore current director

Looks like endlocal restores not just the "current working directory" (%cd%), but also the "current directory" on each drive (%=C:% etc) - which includes removing =X: pseudo variables that may have been created inside the block. :: assumes C:, D:, E: each have \tmp\1, \tmp\2 dire...