Search found 234 matches

by pieh-ejdsch
03 Jan 2021 10:33
Forum: DOS Batch Forum
Topic: .bat does not always pass parameter correctly at EOF (end-of-file)
Replies: 2
Views: 386

Re: .bat does not always pass parameter correctly at EOF (end-of-file)

It's actually related to the redirect. If the redirect sneaks into the command out of place, then the first token after the redirection is missing a whitespace character. If there are more than two tokens behind the redirection, the command line is executed in full. It is best to put the redirect at...
by pieh-ejdsch
01 Jan 2021 06:38
Forum: DOS Batch Forum
Topic: Equivalent 9XDos code to NT Find bat/cmd path %~dp0
Replies: 12
Views: 811

Re: Equivalent 9XDos code to NT Find bat/cmd path %~dp0

If you change to another directory, a possible drive change must also be made afterwards. I created an equivalent for Pushd and Popd in the win98 timestamp bat to create these variables (yy mm and so on). https://administrator.de/forum/win98-batch-datum-ermitteln-variable-splitten-tag-mon-jahr-22131...
by pieh-ejdsch
18 Oct 2020 05:19
Forum: DOS Batch Forum
Topic: Proper way of getting function arguments with spaces and specials characters...
Replies: 3
Views: 1475

Re: Proper way of getting function arguments with spaces and specials characters...

maybe you can try it. :argsNtoTokens @echo off for /f "delims==" %%a in ('2^>nul set param_') do set "%%a=" if ! lss ' (setlocal disabledelayedexpansion) else setlocal @set prompt=$g$s :::::::::::::::::::: setting :::::::::::::::::::::::::::::::::: rem use comma or space as delimiter: set argsN=2,3,...
by pieh-ejdsch
13 Sep 2020 15:39
Forum: DOS Batch Forum
Topic: A problem with symlink script
Replies: 6
Views: 1651

Re: A problem with symlink script

Hi absolutelyrandom1234, Is always problematic if the delayed variables are taken in the For-loop - but work is still delayed in "do". All that comes out is gibberish. Mixing the delayed- with forvariables can be done if there are no special characters to be expected. Always work with a delay in "in...
by pieh-ejdsch
06 Sep 2020 11:25
Forum: DOS Batch Forum
Topic: FOR doesn't iterate properly
Replies: 4
Views: 1360

Re: FOR doesn't iterate properly

You can display the for variable so that it only expands to the filename.

Code: Select all

for %%G IN (*.pdf) DO Echo %%~nG
by pieh-ejdsch
12 Aug 2020 09:43
Forum: DOS Batch Forum
Topic: Letter used in a variable.
Replies: 15
Views: 2978

Re: Letter used in a variable.

The errorlevel of chice is output exactly after the index of the characters. The extension of variables is done according to the offset. Why do you change the index to letter? Oh, you still need in the script. But if NOT 1 if - then it is also sufficient: set drives= abcde choice /c %drives% /n /m "...
by pieh-ejdsch
14 Jul 2020 10:53
Forum: DOS Batch Forum
Topic: Why doesn't this replacement work?
Replies: 3
Views: 1555

Re: Why doesn't this replacement work?

Hallo, That's how you actually write one-liners! You should simply write the list as it is with each other in the for- loop, then you will have it a little clearer. A second for-loop for the name of the log file completes the matter. IF DEFINED X for /f "tokens=2delims==" %%K in ("FDMEE_KOF=_KICKOUT...
by pieh-ejdsch
21 Jun 2020 12:21
Forum: DOS Batch Forum
Topic: Repetitively read x lines from txt file and pass to called program
Replies: 1
Views: 1139

Re: Repetitively read x lines from txt file and pass to called program

Hallo Bryan, Your example has only 34 lines ... I would not read the lines, but always read the first block line. Look for the 4-digit number and create the file with this number. Then transfer to the processing program. The last file is treated at the end - or the first line of the original file is...
by pieh-ejdsch
14 Jun 2020 05:07
Forum: DOS Batch Forum
Topic: Recursively Delete File Types From A Named Folder Only
Replies: 2
Views: 1340

Re: Recursively Delete File Types From A Named Folder Only

you can use a for /r loop in a recursive search

Code: Select all

( for /d /r %%a in (Target-Folder.?) do @ DEL /S /Q "%%a\*.psr" "%%a\*.zip" ) >Deleted-psr-zip.txt 2>&1
Phil
by pieh-ejdsch
03 Jun 2020 09:01
Forum: DOS Batch Forum
Topic: How to add 'del ' as leading sttring of all lines of a file ?
Replies: 2
Views: 1293

Re: How to add 'del ' as leading sttring of all lines of a file ?

vorticity wrote:
02 Jun 2020 12:10
My problem: writing file1.jpg file2.jpg ... into a file for the ftp_delete_script is easy...
You write this into this - how?
Manually...
Is a list with this files there?

Phil
by pieh-ejdsch
01 Jun 2020 10:29
Forum: DOS Batch Forum
Topic: Copy files do not overwrite existing
Replies: 11
Views: 16736

Re: Copy files do not overwrite existing

First you create a list of the files to be excluded. Only those that are in the source and the destination are listed. So the command backwards xcopy /LUY target source Just a bit with showing the source files. You add this to your correct command as an exclusion list. @echo off setlocal set prompt=...
by pieh-ejdsch
23 May 2020 13:23
Forum: DOS Batch Forum
Topic: Self Updating Continuously Running Batch
Replies: 7
Views: 2316

Re: Self Updating Continuously Running Batch

This batch does not use a label and can be changed easily, so it is the changeable second part. Only a copy is made in a subfolder, which then runs and runs ... @ rem Don't change this part @echo off setlocal rem Endless update part. This part controls the copying/updating of the batch. rem The batc...
by pieh-ejdsch
17 Apr 2020 11:59
Forum: DOS Batch Forum
Topic: How to make a scanner that scans a batch file?
Replies: 3
Views: 2274

Re: How to make a scanner that scans a batch file?

A simple first checkCMD.cmd that was started, which was created to find corresponding commands, variables, brackets, parameters etc. in batch files, is here. The output contains the numbers and the line found. This script can be easily expanded and new parameters and corresponding search terms can b...
by pieh-ejdsch
12 Apr 2020 16:32
Forum: DOS Batch Forum
Topic: Can't parse arguments to variable
Replies: 5
Views: 2732

Re: Can't parse arguments to variable

The comparison with your IF line does not work out as you would expect. If you want to know what goes wrong then you have to evaluate the displayed errors. For successful troubleshooting, it has proven useful to switch on the echo and thus to find something in the last displayed lines that leads to ...