Search found 21 matches
- 23 Jan 2025 18:42
- Forum: DOS Batch Forum
- Topic: How to pass a variable in batch/javascript hybrid
- Replies: 6
- Views: 6203
Re: How to pass a variable in batch/javascript hybrid
This requires quite some trickery where you should execute the the JScript in a WSF job that respects the "encoding" attribute. However, this is still not good enough to make it work for the underlying pipe in a FOR /F loop. So, you need a UTF-16 encoded temporary file... proof of concept <?xml : :...
- 23 Jan 2025 15:44
- Forum: DOS Batch Forum
- Topic: How to pass a variable in batch/javascript hybrid
- Replies: 6
- Views: 6203
Re: How to pass a variable in batch/javascript hybrid
Escaping all the characters that have a special meaning in batch can be an annoying task. Furthermore it's a well known issue that the scripting engines of VBScript and JScript remove all quotes from the arguments you pass to a script and there's nothing that you could do to prevent this. So, don't...
- 22 Jan 2025 23:11
- Forum: DOS Batch Forum
- Topic: Tokens do not pass after 31, is there some way that i can pass this limit?
- Replies: 6
- Views: 8763
Re: Tokens do not pass after 31, is there some way that i can pass this limit?
If you need spaces between chars, then: @echo off setlocal enabledelayedexpansion set "KEYS=1 2 3 4 5 6 7 8 9 0 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z" for /f %%m in ('">$ cmd/v/c echo.!KEYS!& echo $"') do set /a char_count=%%~zm-37& del $ for /l %%a in (1,1,%char_count%) do ( set s=%%a...
- 22 Jan 2025 22:03
- Forum: DOS Batch Forum
- Topic: Tokens do not pass after 31, is there some way that i can pass this limit?
- Replies: 6
- Views: 8763
Re: Tokens do not pass after 31, is there some way that i can pass this limit?
Maybe this will help... @echo off setlocal enabledelayedexpansion set "KEYS=1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ" for /f %%m in ('">$ cmd/v/c echo.!KEYS!& echo $"') do set /a char_count=%%~zm-2& del $ for /l %%a in (1,1,%char_count%) do ( set s=%%a&&call :pro ) pause :pro set /a startchar=%s%-1 SET ...
- 22 Jan 2025 11:53
- Forum: DOS Batch Forum
- Topic: How to pass a variable in batch/javascript hybrid
- Replies: 6
- Views: 6203
How to pass a variable in batch/javascript hybrid
Here's simple code: 0</*! :: @echo off set "c=0.618" cscript //nologo //e:javascript "%~f0" %* add("%c%") pause goto :EOF */0; function add(c){ return c; } WScript.Echo(eval(WScript.Arguments(0))); Expecting return is 0,618 as it gives when "c" is a number. But when "c" is something like this: "c="j...
- 24 Mar 2023 05:51
- Forum: DOS Batch Forum
- Topic: Read window line from parent cmd without writing to file
- Replies: 6
- Views: 6729
Re: Read window line from parent cmd
Accordingly to your last test, this should work: for /f "usebackq tokens=5 delims=: " %%i in ('pstat.exe ^| findstr /i "memory"') do echo %%i Note that you changed the "backtit" ("`" character) by apostrophe... If this not works, remove the usebackq option from FOR /F switch. Antonio Of course, it'...
- 23 Mar 2023 15:34
- Forum: DOS Batch Forum
- Topic: Read window line from parent cmd without writing to file
- Replies: 6
- Views: 6729
Re: Read window line from parent cmd
Run pmon.exe only and post the results (between code tags, please). Saso Here the first line of the pstat.exe window... others are similar: Pstat version 0.2: memory: 2000000 kb uptime: 1 5:49:06.598 I have positive result with writing to file and then proccessing the line (mistake in 3rd line is c...
- 23 Mar 2023 07:58
- Forum: DOS Batch Forum
- Topic: How to put inner quotes in outer quotes in "for" loop?
- Replies: 17
- Views: 54189
Re: How to put inner quotes in outer quotes in "for" loop?
I don't understand what you are trying to do, so I have no idea how to solve your problem. It sounds like you are trying to communicate between different processes, which would require communication via files. I use that technique in my SNAKE.BAT batch game. Buried in that thread is a description o...
- 23 Mar 2023 06:45
- Forum: DOS Batch Forum
- Topic: Read window line from parent cmd without writing to file
- Replies: 6
- Views: 6729
Re: Read window line from parent cmd
What happens if you remove the 'start' command? for /f "usebackq tokens=2 delims=: " %i in (`pmon.exe ^|findstr /i "memory"`) do echo %i Saso Nothing. The cursor hangs in the parental window, and the pmon.exe window does not start ... It could be another cmd utility, not necessary pmon.exe. The ide...
- 23 Mar 2023 05:16
- Forum: DOS Batch Forum
- Topic: Read window line from parent cmd without writing to file
- Replies: 6
- Views: 6729
Read window line from parent cmd without writing to file
Sholom there! Trying to write 2nd's cmd window's stdout that starts from 1st cmd to a variable but haven't succeed yet... Seems to me that some redirection with "1", "2", "&" must take place, but don't know how to do it... Here's my trying: for /f "usebackq tokens=2 delims=: " %i in (`start /i pmon....
- 22 Mar 2023 14:13
- Forum: DOS Batch Forum
- Topic: How to put inner quotes in outer quotes in "for" loop?
- Replies: 17
- Views: 54189
Re: How to put inner quotes in outer quotes in "for" loop?
I am lurking in the shadows. :twisted: Actually I have found another hobby that has been sucking up my time - VCV Rack, a Eurorack modular synth emulator for the computer. I am learning all I can about synthesis, as well as creating patches that play themselves so I can use them as accompaniment fo...
- 07 Jul 2022 11:33
- Forum: DOS Batch Forum
- Topic: [How-To] HEX dump raw data of a drive sector (PowerShell hybrid)
- Replies: 12
- Views: 21536
Re: [How-To] HEX dump raw data of a drive sector (PowerShell hybrid)
Dfswin.exe it's a cmd-version of dfsee.exe which is a generic disk, partition and filesystem utility for maintenance and data-recovery. Yes it's possible to devide this task to several ones but cutten possibilities remind me circumcision... 

- 07 Jul 2022 10:36
- Forum: DOS Batch Forum
- Topic: [How-To] HEX dump raw data of a drive sector (PowerShell hybrid)
- Replies: 12
- Views: 21536
Re: [How-To] HEX dump raw data of a drive sector (PowerShell hybrid)
If you trust me, use the lightweight executable in the attached zip file. It bahaves pretty much the same as the macro code above. That's how you may use it: @echo off &setlocal EnableExtensions EnableDelayedExpansion cd /d "%~dp0" set "hex=" for /f "tokens=1* delims=[]" %%i in ('drivedump.exe "Phy...
- 07 Jul 2022 10:01
- Forum: DOS Batch Forum
- Topic: How to put inner quotes in outer quotes in "for" loop?
- Replies: 17
- Views: 54189
Re: How to put inner quotes in outer quotes in "for" loop?
Does anybody know what's happened with Dave and where his pure integral perfect code?



- 11 Feb 2022 00:50
- Forum: DOS Batch Forum
- Topic: [How-To] HEX dump raw data of a drive sector (PowerShell hybrid)
- Replies: 12
- Views: 21536
Re: [How-To] HEX dump raw data of a drive sector (PowerShell hybrid)
Doing this in a script is an impressive achievement... But calling the WIN32 APIs directly in C is far more efficient! My old sector.exe tool, available in the System Tools Library , allows dumping disk sectors as hexadecimal, copying them to and from files, etc. I've even used it multiple times to...