Search found 146 matches
- 03 Sep 2017 04:48
- Forum: DOS Batch Forum
- Topic: %~f1 %~f1 %~p1 %~n1 variable fixing and slightly redefining to sync with other soft.
- Replies: 9
- Views: 9406
Re: %~f1 %~f1 %~p1 %~n1 variable fixing and slightly redefining to sync with other soft.
I've changed your code. Please try to understand these steps before you put them into another batch file. @echo off SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION SET FFF0=%1 SET FFF1=%~f1 SET FFF2=%~d1 set FFF2=%FFF2:~0,1% SET FFF3=%~p1 set FFF3=%FFF3:~0,-1% SET FFF4=%~n1 SET FFF5=%~x1 set FFF5=%...
- 07 Oct 2016 05:22
- Forum: DOS Batch Forum
- Topic: Regular expressions not working in batch script for pinging subnet
- Replies: 3
- Views: 4571
Re: Regular expressions not working in batch script for pinging subnet
The search string (RegEx), which can be used here, is unfortunately not possible to enter in FINDSTR. Search string: ^Reply from 192\.168\.4\.(?!20:)\d+ A solution with FINDSTR is possible. The blanks can be replaced with a dot. The dots between the digits are replaced by a metacharacter. Each searc...
- 11 Jul 2016 01:52
- Forum: DOS Batch Forum
- Topic: If...Else If - how to make this work
- Replies: 5
- Views: 6696
Re: If...Else If - how to make this work
Nesting of IF-blocks is possible, but each of IF blocks must be set up correctly. IF cond (TRUE block) else (FALSE block) Or you can write this in this form: IF cond ( TRUE block ) else ( FALSE block ) Now inserting a second condition: IF cond1 ( if cond2 ( RESULT1 block ) else ( RESULT2 block ) ) e...
- 13 Jan 2016 16:16
- Forum: DOS Batch Forum
- Topic: simple batch file
- Replies: 3
- Views: 4688
Re: simple batch file
I have change your code. Here my code: @ECHO OFF ECHO. SETLOCAL EnableExtensions EnableDelayedExpansion set i=0 for /f "tokens=*" %%f in ('dir /b D:\Versuch\source') do ( set /a i+=1, help="i %% 7" move /y "D:\Versuch\source\%%f" D:\Versuch\destination >nul if "!he...
- 18 Dec 2015 18:39
- Forum: DOS Batch Forum
- Topic: High compression for dos batch files
- Replies: 5
- Views: 6495
Re: High compression for dos batch files
In the following text, two different encoding methods are illustrated. Both methods give the same size at random. Huffman coding Link: https://en.wikipedia.org/wiki/Huffman_coding Link: http://huffman.ooz.ie/?text=NEVER%20CHANGE%20A%20RUNNING%20SYSTEM. NEVER CHANGE A RUNNING SYSTEM. 30 characters NE...
- 23 Nov 2015 05:03
- Forum: DOS Batch Forum
- Topic: call set bug?
- Replies: 8
- Views: 9218
Re: call set bug?
I have the code from the first Postin changed somewhat. @echo off setlocal enableextensions disabledelayedexpansion set ^"str= hello ^&^"^& world! ^" echo CALL ^&^& echo(success ^|^| echo(failure call && echo(success || echo(failure echo. echo. echo (CALL) ^&am...
- 12 Nov 2015 19:02
- Forum: DOS Batch Forum
- Topic: Sdel - speedy deletion utility
- Replies: 64
- Views: 52546
Re: Sdel secure speedy deletion utility
I have the code adjusted so that this batch file can be started with parameters. Before the echo commands are removed, the security query should be installed. It should also be checked, what happens when a placeholder '*' and '?' in the file name or folder name are available. It when the placeholder...
- 07 Nov 2015 16:51
- Forum: DOS Batch Forum
- Topic: Delayed Expansion in Subs- Again
- Replies: 12
- Views: 10991
Re: Delayed Expansion in Subs- Again
Your code updated. @echo off & SETLOCAL ENABLEDELAYEDEXPANSION SET _STRING=to be replaced SET _NEWSTRING=not replaced IF TRUE==TRUE ( SET "_NEWSTRING=%_STRING:to be r=r%" echo "%_STRING%" "%_NEWSTRING%" ## "%_STRING%" "!_NEWSTRING!" IF "!_NE...
- 07 Nov 2015 16:27
- Forum: DOS Batch Forum
- Topic: Sdel - speedy deletion utility
- Replies: 64
- Views: 52546
Re: type nul and ren *.*
Code for one file:
Code for all files in a folder:
Code: Select all
type nul > file.ext
Code for all files in a folder:
Code: Select all
for %%a in (*.*) do type nul > %%a
- 06 Nov 2015 22:29
- Forum: DOS Batch Forum
- Topic: Sdel - speedy deletion utility
- Replies: 64
- Views: 52546
Re: type nul and ren *.*
In a batch file some logical errors are present. With the SET command input is required. But what happens if you do not "d" or "f" typing or no file should be deleted? If you have the part "f" processed immediately follows the part "d". This has been certainly...
- 06 Nov 2015 20:38
- Forum: DOS Batch Forum
- Topic: Changing date from MM/DD/YY to MM/DD/YYYY format
- Replies: 4
- Views: 6015
Re: Changing date from MM/DD/YY to MM/DD/YYYY format
Here are two solutions. Solution 1 can under certain circumstances produce erroneous information. Errors come about when the sign "/", "-" or the comma "," within expressions are with double quotes. The solution 2 can under certain circumstances produce erroneous inform...
- 28 Oct 2015 18:38
- Forum: DOS Batch Forum
- Topic: Definition and use of arithmetic "functions" in Batch files
- Replies: 27
- Views: 40113
Re: Definition and use of arithmetic "functions" in Batch fi
The Sign fuction is defineted: Value x < 0 is Sgn(x) = -1 Value x = 0 is Sgn(x) = 0 Value x > 0 is Sgn(x) = 1 See also: https://en.wikipedia.org/wiki/Sign_function D:\CMDVerz>set /a a=32,"(a>>31)+!(a>>31)*!!a" 1 D:\CMDVerz>set /a a=0,"(a>>31)+!(a>>31)*!!a" 0 D:\CMDVerz>set /a a=-...
- 26 Oct 2015 04:15
- Forum: DOS Batch Forum
- Topic: GOTO wont work anymore? Im so lost
- Replies: 11
- Views: 10244
Re: GOTO wont work anymore? Im so lost
The values that are available in an IF construct to enclose with double quotes . But you have used single quotes. If all conditions are not met, then you should either an error message (such as "The birth planet is unknown.") Issued or to jump back to the beginning of the input, or both. @...
- 25 Oct 2015 05:01
- Forum: DOS Batch Forum
- Topic: GOTO wont work anymore? Im so lost
- Replies: 11
- Views: 10244
Re: GOTO wont work anymore? Im so lost
@penpen Your generated batch file runs in a continuous loop. With " GOTO: next " you jump to the first ever jump label of " :next ". @all users With a few small changes to the batch file of penpen. Creates the file: Test60a.bat @echo off >"test60a.bat" ( echo(@echo off ...
- 23 Oct 2015 14:33
- Forum: DOS Batch Forum
- Topic: set a command as an environmental variable
- Replies: 2
- Views: 3870
Re: set a command as an environmental variable
Here is a example for a batch file. This batch is waiting for a code " 1234 " or " 123456 ". @echo off setlocal EnableExtensions :top echo. set /p word=Please insert a code word: set "var=if %word%==" :: then you can type the following echo. %var%1234 (echo Hello user) ...