Search found 208 matches

by siberia-man
20 Dec 2014 12:33
Forum: DOS Batch Forum
Topic: Detecting Process ID of the current cmd.exe
Replies: 46
Views: 125150

Re: Detecting Process ID of the current cmd.exe

Squashman , your suggestion is good enough for cases when you don't need piping one script to another one. Look here The %RANDOM% variable as the part of the filename can lead to conflicts in pipes. and try this one in pipe :: script | script @echo:%time% %random%>&2 The result of this pipe can...
by siberia-man
20 Dec 2014 11:19
Forum: DOS Batch Forum
Topic: Detecting Process ID of the current cmd.exe
Replies: 46
Views: 125150

Detecting Process ID of the current cmd.exe

cmd.exe doesn't provide its own Proccess ID (or PID). What could PID be useful for? It is unique number in the current moment. -- With PID it is easy to refer to own process. The TASKLIST utility is not robust - just launch two instances of cmd.exe and you can't say which one is your own. -- It can ...
by siberia-man
26 Nov 2014 04:11
Forum: DOS Batch Forum
Topic: Help with program that emulate VT100 terminal
Replies: 32
Views: 33958

Re: Help with program that emulate VT100 terminal

For those guys who find it as the interesting and useful stuff. I've updated the post above. -- better processing of the command line options -- new option --no-new-line was added for discarding the trailing new lines -- new feature: if the first argument is empty string (like this ""), th...
by siberia-man
13 Nov 2014 19:58
Forum: DOS Batch Forum
Topic: Help with program that emulate VT100 terminal
Replies: 32
Views: 33958

Re: Help with program that emulate VT100 terminal

One more instance of the ANSI emulator. It supports some of (but not all) ANSI sequences very close to those terminals. + No tricks with batch script attempting to colorize output + No executable binaries - PowerShell required (can be absent on some hosts) - No executable binaries (script works slow...
by siberia-man
09 Nov 2014 08:24
Forum: DOS Batch Forum
Topic: js/vbs/html/hta and more hybrids and chimeras in cmd/bat
Replies: 64
Views: 315086

Re: js/vbs/html/hta hybrids and chimeras in cmd/bat

The post viewtopic.php?p=37780#p37780 was updated.

Now the script is able to produce working wrapper for powershell script. Now the hybrid is able to read stdin on the same way as the original powershell script.
by siberia-man
08 Nov 2014 10:40
Forum: DOS Batch Forum
Topic: Detect redirection and EOF in Standard Handles
Replies: 3
Views: 12848

Re: Detect redirection and EOF in Standard Handles

Seems there is no internal way to detect if a handler is redirected to a file or another pipe. With this idea as base, I wrote a very small and simple .COM program that allows to detect if a standard handle has been redirected to a disk file Aacini , what if you share the original assembler code of ...
by siberia-man
06 Nov 2014 01:40
Forum: DOS Batch Forum
Topic: js/vbs/html/hta and more hybrids and chimeras in cmd/bat
Replies: 64
Views: 315086

Re: js/vbs/html/hta hybrids and chimeras in cmd/bat

fixes and improvements to the code above. The message was updated. Feature list: -- It does comment on "Option Explicit" in VBScript. -- "<?xml?>" declaration for wsf-files is expected. -- "Option Explicit" and "<?xml?>" in a single line only are supported. --...
by siberia-man
04 Nov 2014 06:16
Forum: DOS Batch Forum
Topic: Powershell2/bat hybrid?
Replies: 26
Views: 93538

Re: Powershell2/bat hybrid?

Yep. Seems there are no better ways to hybridize cmd and powershell (or embed powershell into a batch file). Anyway this solution keeps ability for piping and allows using of command lines arguments through $args (I guess this is standard variable in powershell).
by siberia-man
03 Nov 2014 21:01
Forum: DOS Batch Forum
Topic: js/vbs/html/hta and more hybrids and chimeras in cmd/bat
Replies: 64
Views: 315086

Re: js/vbs/html/hta hybrids and chimeras in cmd/bat

bars143 You are right. The script produces non-working script when the original vbs-file has "Option Explicit". I found it, as well, when I asked myself "what if I code using this directive?" I have modified the "cmdize" script but the solution is so ugly and so funny....
by siberia-man
03 Nov 2014 17:02
Forum: DOS Batch Forum
Topic: Powershell2/bat hybrid?
Replies: 26
Views: 93538

Re: Powershell2/bat hybrid?

Found few hours ago: blogs.msdn.com/b/jaybaz_ms/archive/2007/04/26/powershell-polyglot.aspx stackoverflow.com/a/2611487/3627676 In my opinions this solution is the best of known. Also you can find my attempt to compile all available solutions in one script. See this thread: http://www.dostips.com/fo...
by siberia-man
03 Nov 2014 17:00
Forum: DOS Batch Forum
Topic: js/vbs/html/hta and more hybrids and chimeras in cmd/bat
Replies: 64
Views: 315086

Re: js/vbs/html/hta hybrids and chimeras in cmd/bat

I decided come back to this thread attempting to cover most of issues in one solution =) I spent few minutes thinking how to name the script. There were three possible candidates: -- any2bat or every2bat (similar to pl2bat or js2bat, but "any" or "every" don't cover everything) -...
by siberia-man
21 Oct 2014 11:00
Forum: DOS Batch Forum
Topic: robust line counter
Replies: 22
Views: 30886

Re: robust line counter

Sponge Belly
Agree with you. "more" has much more problems with huge lines. I remember once I have had inadequate behavior with lines over 64K characters.
by siberia-man
20 Oct 2014 12:36
Forum: DOS Batch Forum
Topic: robust line counter
Replies: 22
Views: 30886

Re: robust line counter

Code: Select all

more FILENAME | find /c /v ""


this works, as well
by siberia-man
17 Oct 2014 00:29
Forum: DOS Batch Forum
Topic: doskey /history doesn't work properly after doskey reinstall
Replies: 3
Views: 5747

Re: doskey /history doesn't work properly after doskey reins

Aacini, thank you. Probably this is the most robust solution to clear history and keep the functionality:

Code: Select all

doskey /listsize=0
doskey /listsize=50

where the default value 50 can be replaced by another value as requested.
by siberia-man
16 Oct 2014 13:15
Forum: DOS Batch Forum
Topic: doskey /history doesn't work properly after doskey reinstall
Replies: 3
Views: 5747

doskey /history doesn't work properly after doskey reinstall

I am not sure if this is specific for my computer. Can some one test it and confirm? The test is very simple. 1. open command prompt 2. execute few commands 3. check the command history by the command doskey /history 4. clear the history list doskey /reinstall 5. repeat the item 2 (arbitrary command...