Search found 93 matches

by sst
03 Jun 2018 17:21
Forum: DOS Batch Forum
Topic: Stop Command Prompt Empty Line
Replies: 17
Views: 16668

Re: Stop Command Prompt Empty Line

XY Problem How so? Ignore this post if your are not interested to know how others may possibly interpret your post and how it is difficult to diagnose the problem and suggest solutions based on the kind of information that is provided. In the next post I will try to diagnose and suggest a solution ...
by sst
03 Jun 2018 02:09
Forum: DOS Batch Forum
Topic: Stop Command Prompt Empty Line
Replies: 17
Views: 16668

Re: Stop Command Prompt Empty Line

The more I look at this topic the more it becomes clear to me that it is an instance of XY Problem. Maybe even a nested one.
by sst
01 Jun 2018 10:46
Forum: DOS Batch Forum
Topic: Help with substring removal
Replies: 2
Views: 2821

Re: Help with substring removal

Percent variable expansion will take place before execution of the code and it occurs only once within a block of code. So when your code is executing, %outfile% variable is already expanded to nothing (or to whatever it has been defined before that block of code). Use delayed variable expansion to ...
by sst
30 May 2018 22:50
Forum: DOS Batch Forum
Topic: How to mask a blank inside nested quotes?
Replies: 11
Views: 10166

Re: How to mask a blank inside nested quotes?

@penpen by saing ..... if Command Extensions are disabled bye default. It is rare and uncommon but still a possibility. I mean when Command Extensions are disabled at registry level. Of course Command Extensions can be enabled from within batch file with setlocal but that would enable Extensions for...
by sst
30 May 2018 10:58
Forum: DOS Batch Forum
Topic: How to mask a blank inside nested quotes?
Replies: 11
Views: 10166

Re: How to mask a blank inside nested quotes?

In for /f loop - You only must create a first command token with no space for /F usebackq %%L in (`if 1 equ 1 "%PROG%myprog.exe" ...... %%F`) do set %%L Phil That's OK for demonstrating the concept but it should noted that using it as a general method will lead to failure if Command Extensions are ...
by sst
30 May 2018 03:10
Forum: DOS Batch Forum
Topic: How to mask a blank inside nested quotes?
Replies: 11
Views: 10166

Re: How to mask a blank inside nested quotes?

Adding to jeb's solution: for /F usebackq %%L in (`@"%PROG%myprog.exe" ...... %%F`) do set %%L The trick with CALL and at-sign(@) here is to prevent the first character that comes after /c switch to be a double quote(") so cmd will not enter command line quote processing phase. With any of the follo...
by sst
28 May 2018 08:28
Forum: DOS Batch Forum
Topic: How to mask a blank inside nested quotes?
Replies: 11
Views: 10166

Re: How to mask a blank inside nested quotes?

Use this from for /F usebackq %%L in (`^""%PROG%myprog.exe" ...... %%F^"`) do set %%L for /F internally runs cmd /c <FOR /F command> cmd will preserve quotes only when invoked without /S switch which is the case, and if there are exactly just two quote characters on the command line which is also th...
by sst
26 May 2018 18:58
Forum: DOS Batch Forum
Topic: difficult starting cmd prompt with execution of two commands
Replies: 4
Views: 5302

Re: difficult starting cmd prompt with execution of two commands

Funnily enough this doesn't work C:\>start cmd /k echo abc "&" echo def even though the argsv come out the same C:\>w cmd /k echo abc "&" echo def argv[0] = w argv[1] = cmd argv[2] = /k argv[3] = echo argv[4] = abc argv[5] = & argv[6] = echo argv[7] = def Though the command line is different for th...
by sst
25 May 2018 23:00
Forum: DOS Batch Forum
Topic: Get arguments without temporary file
Replies: 24
Views: 18083

Re: Get arguments without temporary file

One thing I'm still unsatisfied with is the macro (re)definition of "return", it's possible to override an existing macro. It would be better to take another name or even better to store the macro definition and restore it later Why not use /EXENAME switch. set "MyDosKeyNameSpace=SomeUniqueString" ...
by sst
22 May 2018 21:27
Forum: DOS Batch Forum
Topic: batch file to find and replace in sequence
Replies: 3
Views: 3565

Re: batch file to find and replace in sequence

For the search and replace part you can use JREPL.BAT I would recommend to first study and learn how to use JREPL.BAT. After you get familiar with it's usage and syntax then you can think about how to iterate through your php and keywrods files to perform the sequential search and replace on all you...
by sst
22 May 2018 11:46
Forum: DOS Batch Forum
Topic: How do i return a string from cpp program to caller batch file?
Replies: 8
Views: 7738

Re: How do i return a string from cpp program to caller batch file?

@jfl, There are numerous resources on the net for start https://www.endgame.com/blog/technical-blog/ten-process-injection-techniques-technical-survey-common-and-trending-process https://github.com/secrary/InjectProc http://blogs.microsoft.co.il/pavely/2017/03/14/injecting-a-dll-without-a-remote-thre...
by sst
22 May 2018 01:48
Forum: DOS Batch Forum
Topic: Mouse Cursor in Dos Program
Replies: 1
Views: 2909

Re: Mouse Cursor in Dos Program

The mouse pointer is hidden probably because your are using the mouse driver that is designed for your touch screen. So it logically hide the pointer for a touch screen. Maybe you can force it to display the pointer by some command line switch or manipulating the it's INI files. Or better try anothe...
by sst
21 May 2018 21:30
Forum: DOS Batch Forum
Topic: Length of a string - my first contribution
Replies: 4
Views: 4009

Re: Length of a string - my first contribution

Besides of problems that may arise as a result of assumptions about unicode encoding which has been addressed by penpen, I can think of some other problems which will prevent the usage of this method as a general purpose string length routine. This method will fail if 1. LineFeed character is presen...
by sst
21 May 2018 19:46
Forum: DOS Batch Forum
Topic: How do i return a string from cpp program to caller batch file?
Replies: 8
Views: 7738

Re: How do i return a string from cpp program to caller batch file?

Another way would be for the cpp program to generate a temporary batch file with the set commands. The OP is already aware of temp file technique, the question was about possibility of a method to do the assignment directly with custom external program, so using a temporary batch file instead of te...
by sst
20 May 2018 08:48
Forum: DOS Batch Forum
Topic: difficult starting cmd prompt with execution of two commands
Replies: 4
Views: 5302

Re: difficult starting cmd prompt with execution of two commands

You know that & is command splitter but forgot that this line start cmd /k (echo abc & echo def) will be parsed and splitted in to two separate commands before the second cmd instance have a chance to grab it as command line. your line will basically will be converted to this before execution start ...