Search found 511 matches
- 20 Feb 2018 06:10
- Forum: DOS Batch Forum
- Topic: reverse string without goto
- Replies: 10
- Views: 14532
Re: reverse string without goto
Here's my attempt (it uses strlen macro): :reverse [%1 - string to reverse ; %2 - if defined will store the result in variable with same name] @echo off setlocal disableDelayedExpansion set "str=%~1" set LF=^ rem ** Two empty lines are required set ^"\n=^^^%LF%%LF%^%LF%%LF%^^" set $strLen=for /L %%n...
- 16 Feb 2018 15:54
- Forum: DOS Batch Forum
- Topic: Why REM inside a block?
- Replies: 14
- Views: 11887
Re: Why REM inside a block?
color behaves strangely with this script at least on my machine: Normal -------------------------------- 53780 ms color 1550 ms cd . 1590 ms ver >nul 1280 ms date /t >nul 1270 ms time /t >nul 1250 ms verify >nul 670 ms call; 690 ms (call ) 530 ms (call) stdout already redirected to nul -------------...
- 16 Feb 2018 07:52
- Forum: DOS Batch Forum
- Topic: Why REM inside a block?
- Replies: 14
- Views: 11887
Re: Why REM inside a block?
Perhaps that was the intent, but it does not work that way. REM never sets the ERRORLEVEL - the value that existed before the remark is preserved. It should not be an issue for that code because the only other command in the block is ECHO, which also preserves the ERRORLEVEL. If you ever need to ex...
- 16 Feb 2018 07:22
- Forum: DOS Batch Forum
- Topic: Why REM inside a block?
- Replies: 14
- Views: 11887
Re: Why REM inside a block?
I suppose to avoid setting a command at the end of the block that will exit with something different than 0.If this happens the second block will be executed despite files being identical.
- 03 Jan 2018 05:04
- Forum: DOS Batch Forum
- Topic: ComSpec strange behaviour
- Replies: 12
- Views: 12709
Re: ComSpec strange behaviour
The script he's posted has the same behavior on my machine without changing anything in the registry - variables are "deleted" just for the current cmd session. The interesting part is that the FOR /F starts a new instance of cmd (at least when an internal command is called) and it pre-sets PROMPT,C...
- 02 Jan 2018 17:37
- Forum: DOS Batch Forum
- Topic: ComSpec strange behaviour
- Replies: 12
- Views: 12709
Re: ComSpec strange behaviour
looks like for /f presets the comspec (along with prompt and pathext) - https://stackoverflow.com/questions/48067000/why-can-i-iterate-over-comspec-pathext-and-prompt-after-clearing-all-environmen and when comspec is not specified the pipe fails: set "comspec=" ::this will print C:\WINDOWS\system32\...
- 15 Nov 2017 05:32
- Forum: DOS Batch Forum
- Topic: Batch bug that breaks the title bar
- Replies: 2
- Views: 3352
Re: Batch bug that breaks the title bar
You are supposed to execute another batch file with CALL.
Without using CALL the control will be passed to the second batch file and when it ends the control will be not returned to the first one.
Without using CALL the control will be passed to the second batch file and when it ends the control will be not returned to the first one.
- 11 Nov 2017 03:25
- Forum: DOS Batch Forum
- Topic: find text in file .JSON [SOLVED]
- Replies: 5
- Views: 9618
Re: find text in file .JSON
what's the problem with FIND and FINDSTR ? you need to parse the content as JSON you can try this - https://github.com/npocmaka/batch.scripts/blob/master/hybrids/jscript/jsonextractor.bat. The script (still) has no proper help message so what you need to do is something like this: call jsonextractor...
- 20 Oct 2017 06:47
- Forum: DOS Batch Forum
- Topic: Enabling the internal debug outputs of cmd.exe
- Replies: 18
- Views: 39411
Re: Enabling the internal debug outputs of cmd.exe
On windows 10 GeToken and Ungetting functions are no more printed. Another way to do this on win10 is this line: break&(:#) Should be last one in the file - without new lines or anything else behind the closing bracket. All commands except IF and REM are pointed as Type: 0 .(I don't know is this...
- 04 Oct 2017 19:24
- Forum: DOS Batch Forum
- Topic: Cooler multi line comments.
- Replies: 8
- Views: 9454
Cooler multi line comments.
Recently I saw the dbenham update here . The macro comments are cool ,but I was thinking about an improvement. Here it is: @echo off set "/:=goto :/%%" %/:% multi line comment %:/% echo not commented 1 %/:% another multi line comment %:/% echo not commented 2 It uses one 'feature' of GOTO ...
- 04 Oct 2017 08:10
- Forum: DOS Batch Forum
- Topic: Image processing/effects/...
- Replies: 1
- Views: 2498
Image processing/effects/...
Here are few tools that use Wia.image : m For reference I've used this: https://msdn.microsoft.com/en-us/library/windows/desktop/ms630819(v=vs.85).aspx Still I have no idea how to proceed with the ARGB filter (???).Soon I'll add stamp , exif editing and so on. Despite the script share a lot of code ...
- 02 Oct 2017 14:04
- Forum: DOS Batch Forum
- Topic: Running cmd from address bar is buggy.
- Replies: 2
- Views: 3202
Re: Running cmd from address bar is buggy.
Squashman wrote:I put your examples in a batch file and did not get the same results running it from address bar on Windows 7 Pro. It executed like a normal batch file.
I'm with win 8.1 pro . Later I can try with win10.
- 02 Oct 2017 13:37
- Forum: DOS Batch Forum
- Topic: Running cmd from address bar is buggy.
- Replies: 2
- Views: 3202
Running cmd from address bar is buggy.
You might know that you can run a program listed in the %path% in a certain dir by tiping its name in the address bar in a certain folder. But running the cmd in this way seems to be buggy. Examples: set /p= The system cannot find message text for message number 0x2371 in the message file for Applic...
- 11 Sep 2017 05:29
- Forum: DOS Batch Forum
- Topic: When can I use && and || syax?
- Replies: 8
- Views: 15900
Re: When can I use && and || syax?
Btw . Why with pipe and conditional execution operator I can create 4 cmd contexts? echo 1:%cmdcmdline% >&2 && echo 2:%cmdc^mdline% >&2 | echo 3:%cmd^cmdline% & echo 4:%cmdcmdline% output is: 1:"cmd.exe" /s /k pushd "C:\test" 2:C:\WINDOWS\system32\cmd.exe /S /...
- 11 Sep 2017 02:23
- Forum: DOS Batch Forum
- Topic: When can I use && and || syax?
- Replies: 8
- Views: 15900
Re: When can I use && and || syax?
you can also use call: call ErrorReturn.cmd && ECHO Success call ErrorReturn.cmd || ECHO Failure or pipe (though this is not the preferable way to do it) break| ErrorReturn.cmd && ECHO Success break| ErrorReturn.cmd || ECHO Failure The errorlevel is evaluated after the whole line is ...