Search found 3008 matches

by aGerman
17 Jan 2018 12:53
Forum: DOS Batch Forum
Topic: findstr because of extra comma
Replies: 3
Views: 18

Re: findstr because of extra comma

viewtopic.php?f=3&t=8305
In your case it really doesn't matter if you write the redirection in front of the left parenthesis or after the right parenthesis. Meanwhile it's just one of my habits to always write redirections at the beginning of the line.

Steffen
by aGerman
17 Jan 2018 12:44
Forum: DOS Batch Forum
Topic: Delete all files and folders and sub_folders expect some two folders
Replies: 1
Views: 12

Re: Delete all files and folders and sub_folders expect some two folders

Code: Select all

@echo off &setlocal
pushd "E:\Oracle\Middleware\user_projects\domains\Skandia\servers\Extranet-server"
for /f "delims=" %%i in ('dir /ad /b^|findstr /vlix "stage security"') do ECHO rd /s /q "%%i"
popd
PAUSE
If the right folders to delete are displayed then remove ECHO and PAUSE.

Steffen
by aGerman
17 Jan 2018 12:33
Forum: DOS Batch Forum
Topic: findstr because of extra comma
Replies: 3
Views: 18

Re: findstr because of extra comma

I assume that would work for you:

Code: Select all

>"output.txt" (
  for /f "usebackq delims=," %%i in ("dump.txt") do findstr /c:"%%i" "pwd_raw.txt"
)
Of course it will take longer because findstr.exe has to be executed for each line in dump.txt.

Steffen
by aGerman
16 Jan 2018 08:47
Forum: DOS Batch Forum
Topic: Comparing two variables to a number?
Replies: 3
Views: 53

Re: Comparing two variables to a number?

That's exactly the same method as in my first suggestion :wink:

Steffen
by aGerman
16 Jan 2018 05:24
Forum: DOS Batch Forum
Topic: Comparing two variables to a number?
Replies: 3
Views: 53

Re: Comparing two variables to a number?

There is no logical AND or OR linkage for comparisons in batch. Working around AND is quite simple though: if %bandages% GEQ 1 if %flesh% GEQ 1 goto CraftHealth5Complete OR is a little more complicated. Usually a helper variable is in place to perform it: set "helper=" if %bandages% GEQ 1 set "helpe...
by aGerman
14 Jan 2018 07:04
Forum: DOS Batch Forum
Topic: Finding newest file in all subdirectories
Replies: 33
Views: 14798

Re: Finding newest file in all subdirectories

%1 is the first parameter passed to the batch file when it was called. Execute CALL /? to learn more.
%rtn:~18% is the substring of the value in %rtn% beginning after the 18th character till the end. Execute SET /? to learn more.

Steffen
by aGerman
10 Jan 2018 14:01
Forum: DOS Batch Forum
Topic: If conditionals - not working
Replies: 4
Views: 71

Re: If conditionals - not working

This is equivalent to your first code and should explain the behavior: IF DEFINED ERR_FILE ( IF DEFINED FDMEE_ERR ( SET "SW_ATTACH=%LOGFILE%|%ERR_FILE%|%INTRAPATH%%MONTHPOV%%YEARPOV%_%MAXFILE%" MOVE /Y "*.log" "%INTRAPATH%" >nul 2>&1 ) ELSE ( IF NOT DEFINED ERR_FILE ( IF DEFINED FDMEE_ERR ( SET "SW_...
by aGerman
09 Jan 2018 14:55
Forum: DOS Batch Forum
Topic: How to chop off substrings in the txt file
Replies: 6
Views: 109

Re: How to chop off substrings in the txt file

Untested:

Code: Select all

setlocal EnableDelayedExpansion
>"another.txt" (
  for /f "usebackq delims=" %%i ("original.txt") do (
    set "n=%%~ni"
    echo !n:~,6!*%%~xi
  )
)
endlocal
Steffen
by aGerman
08 Jan 2018 07:43
Forum: DOS Batch Forum
Topic: -C -R know funcationality
Replies: 4
Views: 77

Re: -C -R know funcationality

At least I can't answer your question. The developers of a specific program decide if a program accepts command line parameters, and if command line parameters are supported they also decide what parameters they support and what meaning they have. What I'm trying to tell you is that options -C and -...
by aGerman
07 Jan 2018 16:23
Forum: DOS Batch Forum
Topic: Batch code to paste from clipboard to a file?
Replies: 9
Views: 9042

Re: Batch code to paste from clipboard to a file?

I can't change the behavior of the console window in case you don't use option /o. If you want to write to a file then UTF-16 could be used. Set colNamendArgs = WScript.Arguments.Named iNamedArgs = colNamendArgs.Count ret = 1 Do If LCase(Right(WScript.FullName, 11)) <> "cscript.exe" And iNamedArgs =...
by aGerman
06 Jan 2018 05:53
Forum: DOS Batch Forum
Topic: Save and load in batch RPG
Replies: 3
Views: 93

Re: Save and load in batch RPG

2nd code

Code: Select all

@echo off &setlocal

(
  set /p HP=
  set /p DEX=
  set /p money=
)<save.sav

echo Your HP is %HP% - Your Dexterity is %DEX% and you have %money% gold coins
pause
Steffen
by aGerman
03 Jan 2018 11:16
Forum: DOS Batch Forum
Topic: Turn 'DragFullWindows' on
Replies: 1
Views: 102

Re: Turn 'DragFullWindows' on

Changing the registry only is not enough. Applications that change this value will send message WM_SETTINGCHANGE to all open windows. You can't do this using batch. Restarting explorer.exe will most likely only lead to take over the changed values for the explorer and all windows opened after the se...
by aGerman
03 Jan 2018 11:06
Forum: DOS Batch Forum
Topic: Delete many files, need help for creating
Replies: 8
Views: 101

Re: Delete many files, need help for creating

https://www.dostips.com/DosCommandIndex.php#DEL del and then I must jump to every directory and I wanna delete some thousands files. The files are dirt like *.fmt *.bak del /f /s /q /a *.fmt *.bak or 1.gif with one kb for /f "delims=" %%i in ('dir /a-d /b /s *.gif') do if %%~zi leq 1024 del /f /a "%...
by aGerman
30 Dec 2017 11:03
Forum: DOS Batch Forum
Topic: CONVERTCP.exe - Convert text from one code page to another
Replies: 33
Views: 7888

Re: CONVERTCP.exe - Convert text from one code page to another

Yes I removed it, Dave. It would have been possible to check for the existence of the following file argument after option /i. Also leading dashes could have been permitted after option /o. But any additional check would lead to decrease the performance of the tool. Thus, I decided to remove it and ...
by aGerman
30 Dec 2017 08:28
Forum: DOS Batch Forum
Topic: CONVERTCP.exe - Convert text from one code page to another
Replies: 33
Views: 7888

Re: CONVERTCP.exe - Convert text from one code page to another

Recently I found a silly little bug. In the past I supported options with leading dash (besides of leading forward slash). It was an undocumented "feature" which, in the end, was a failure. File names with leading dash were erroneously recognized as options. Fixed with version 1.5. Virustotal: x86: ...