Search found 174 matches

by siberia-man
29 May 2015 08:07
Forum: DOS Batch Forum
Topic: js/vbs/html/hta and more hybrids and chimeras in cmd/bat
Replies: 61
Views: 174680

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

I have extended that suggested gist at https://gist.github.com/ildar-shaimorda ... 0eeacaa3bc. I am thinking to improve my cmdize script with this solution later.
by siberia-man
28 May 2015 03:09
Forum: DOS Batch Forum
Topic: js/vbs/html/hta and more hybrids and chimeras in cmd/bat
Replies: 61
Views: 174680

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

npocmaka_ wrote:just found this :

https://gist.github.com/yaauie/959862


Cool!

So I know how to embed node-js code into batch!

Code: Select all

0</*! ::

@echo off

echo:batch file

node "%~f0"

echo:batch again

goto :EOF

*/0

console.log("Hello World");
by siberia-man
04 Apr 2015 05:09
Forum: DOS Batch Forum
Topic: Powershell2/bat hybrid?
Replies: 25
Views: 45605

Re: Powershell2/bat hybrid?

Nice feature and pretty useful in this case. Definitely, this (script-block) could be better solution than invoke-expression. But there are more lacks than I expected. -------------------------------------- Consider the following powershell script. It will be used further. Let's call it script.ps1 ...
by siberia-man
22 Mar 2015 17:49
Forum: DOS Batch Forum
Topic: js/vbs/html/hta and more hybrids and chimeras in cmd/bat
Replies: 61
Views: 174680

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

The post http://www.dostips.com/forum/viewtopic.php?p=37780#p37780 was updated. Now the powershell-to-bat portion is still better. 1. the code is little bit shorter now (approx. on 50-60 bytes) 2. the trick with $input variable has been removed because scriptblock allows to pass data from STDIN dire...
by siberia-man
22 Mar 2015 17:40
Forum: DOS Batch Forum
Topic: Powershell2/bat hybrid?
Replies: 25
Views: 45605

Re: Powershell2/bat hybrid?

Seems there are no better ways to hybridize cmd and powershell (or embed powershell into a batch file). I am glad to say that I have been wrong. One man from Russian Gray forum and I have had private discussion regarding ps1+bat hybrid. This discussion gave birth the better solution how to hybridiz...
by siberia-man
23 Dec 2014 11:55
Forum: DOS Batch Forum
Topic: Detecting Process ID of the current cmd.exe
Replies: 46
Views: 69544

Re: Detecting Process ID of the current cmd.exe

Couple of issues wmic process where "Name='cmd.exe' and CommandLine like '%%<!uid!>%%'" get ParentProcessID ... do for /f "delims=" %%B in ("%%A") do set "PID=%%B" In this code above -- maybe !uid! should be replaced with %uid% -- the extra trailing whitespace...
by siberia-man
23 Dec 2014 10:28
Forum: DOS Batch Forum
Topic: Detecting Process ID of the current cmd.exe
Replies: 46
Views: 69544

Re: Detecting Process ID of the current cmd.exe

Dave This one setlocal enableDelayedExpansion set "uid=!uid:%%=:p!" ... is executed in the loop. Potentially it could raise the stack overflow error. I guess, this one could be better (with additional changes in the code below. but it should be checked carefully): setlocal enableDelayedEx...
by siberia-man
22 Dec 2014 14:24
Forum: DOS Batch Forum
Topic: Detecting Process ID of the current cmd.exe
Replies: 46
Views: 69544

Re: Detecting Process ID of the current cmd.exe

The full lock file path is transformed into a unique ID - certain characters must be encoded to be valid in the WMIC query string. I use : for encoding because it cannot appear in the path other than after the drive letter. I have two and half questions regarding your suggestion. 1. Could you expla...
by siberia-man
22 Dec 2014 09:59
Forum: DOS Batch Forum
Topic: Detecting Process ID of the current cmd.exe
Replies: 46
Views: 69544

Re: Detecting Process ID of the current cmd.exe

carlos wrote:siberia-man as dbenham says

I guess you have addressed your response to another person. What about me, I know this and confirm it (I performed many tests that confirm dbernham's point). :)
by siberia-man
21 Dec 2014 10:22
Forum: DOS Batch Forum
Topic: Detecting Process ID of the current cmd.exe
Replies: 46
Views: 69544

Re: Detecting Process ID of the current cmd.exe

too complicated. isn't it?
by siberia-man
21 Dec 2014 04:57
Forum: DOS Batch Forum
Topic: Detecting Process ID of the current cmd.exe
Replies: 46
Views: 69544

Re: Detecting Process ID of the current cmd.exe

aGerman I briefly mentioned in the beginning about the problem of using %RANDOM%. dbenham gave good explanation in his SO answer. Regarding this topic I have one question that I can't estimate or solve. The issue is as follows. Could a restricted user run the script properly and obtain an adequate ...
by siberia-man
20 Dec 2014 12:33
Forum: DOS Batch Forum
Topic: Detecting Process ID of the current cmd.exe
Replies: 46
Views: 69544

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: 69544

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: 16118

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: 16118

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...