Search found 115 matches

by Yury
26 Nov 2014 14:50
Forum: DOS Batch Forum
Topic: seek folder in FOR + actions on it
Replies: 3
Views: 899

Re: seek folder in FOR + actions on it

for /f "delims=" %I in ('dir /ad /b /s TOTO^|findstr /e "TOTO"') do (echo "%I"& rename "%I" "TATA") = cd /d "C:\Folder"& for /f "delims=" %I in ('dir /ad /b /s TOTO*^|findstr /e "TOTO"') do (echo "%I"&...
by Yury
26 Nov 2014 06:09
Forum: DOS Batch Forum
Topic: Add date to script?
Replies: 9
Views: 2119

Re: Add date to script?

What shoul you adjust in the script if you like to move file between a particular date @echo off set "from=D:\Test 1" set "to=D:\Test 2" set maxage=20141010 set minage=20141110 pushd "%from%" set movedFiles=0 for /f "tokens=*" %%G in (' robocopy . %random% /n...
by Yury
20 Nov 2014 10:00
Forum: DOS Batch Forum
Topic: Add date to script?
Replies: 9
Views: 2119

Re: Add date to script?

@echo off set "dir=D:\Test" set age=7 pushd "%dir%" set movedFiles=0 for /f "tokens=*" %%G in (' robocopy . %random% /nc /ns /ndl /njh /njs /l /minage:%age% ') do ( echo Moving:.. "%%G" move /y "%%G" "V:\Administratie\CS\Pakbon_Summaries_per_ma...
by Yury
14 Nov 2014 12:22
Forum: DOS Batch Forum
Topic: Read a xml file and copy a perticular text to a new file
Replies: 3
Views: 1153

Re: Read a xml file and copy a perticular text to a new file

@echo off set "in=D:\Test\example.xml" set "out=D:\Test\new.txt" set "from=^<label^>" set "to=^</lablel^>" type "%in%">.tmp mshta "vbscript:CreateObject("Scripting.FileSystemObject").GetStandardStream(1).Write(Split(Split(CreateObject...
by Yury
08 Nov 2014 17:05
Forum: DOS Batch Forum
Topic: Escape Characters
Replies: 13
Views: 10123

Re: Escape Characters

@Yury, I guess that is one way to pseudo do it. But that is more of a flicker then a blink because of the CLS command. Without the CLS command: @echo off set "line=Warning! You are about to delete files..." echo Hello, %username%! echo. cd /d "%~dp0" for /f %%i in (' forfiles /m...
by Yury
07 Nov 2014 06:44
Forum: DOS Batch Forum
Topic: Escape Characters
Replies: 13
Views: 10123

Re: Escape Characters

@echo off set "line=Warning! You are about to delete files..." cd /d "%~dp0" for /f %%i in (' forfiles /m "%~nx0" /c "cmd /c echo 0x08" ') do set BS=%%i set /p=%BS%<nul>"%line%_" for /l %%i in (1 1 100) do ( set /p="Hello, %username%! "<nu...
by Yury
01 Nov 2014 09:11
Forum: DOS Batch Forum
Topic: Checking for several different strings in a variable
Replies: 14
Views: 3746

Re: Checking for several different strings in a variable

Essentially I just want to see if various phrases are in my filename, and if it is then to set a variable one way, and if they're absent, then to set it another. In a sort of pseudo-code: if %InputFilename% contains "*example*" OR "*another*version*" OR "*this*and*that*&quo...
by Yury
31 Oct 2014 11:00
Forum: DOS Batch Forum
Topic: Batch is starting too fast after reboot
Replies: 11
Views: 2133

Re: Batch is starting to fast after reboot

Instead of running the batch file from the RunOnce key, add a self delete command to the bottom of it and place a shortcut to your batch file in the startup folder, "%AppData%\Roaming\Microsoft\Windows\Start Menu\Programs\Startup" . "%AppData%\Microsoft\Windows\Start Menu\Programs\St...
by Yury
31 Oct 2014 09:00
Forum: DOS Batch Forum
Topic: Remove character at begin of line
Replies: 9
Views: 2212

Re: Remove character at begin of line

This will still nuke any leading spaces and any numbers or text before the first "0 " on all the other lines, true? . &cmd /v:on /c call echo.!x:*0 =! foxidrive, this will nuke only the text before the first "0 " and the first "0 ", but with findstr /bc:"0 &qu...
by Yury
31 Oct 2014 07:39
Forum: DOS Batch Forum
Topic: Remove character at begin of line
Replies: 9
Views: 2212

Re: Remove character at begin of line

With the data as shown it will work, but it would be very useful to future readers to state that it will not work as shown with multiple spaces or multiple zeros at the start of the line. This code does not affect the rest of zeros and spaces, and will also work with poison characters and with excl...
by Yury
31 Oct 2014 06:07
Forum: DOS Batch Forum
Topic: Remove character at begin of line
Replies: 9
Views: 2212

Re: Remove character at begin of line

Code: Select all

@(for /f "useback tokens=* delims=0 " %%i in ("example.txt") do @echo.%%i)>"new.txt"
by Yury
31 Oct 2014 05:50
Forum: DOS Batch Forum
Topic: Remove zero if file name start with zero batch
Replies: 7
Views: 2178

Re: Remove zero if file name start with zero batch

Squashman wrote:Yury, I believe they only want to remove the leading Zero. Not all zeros.


Squashman, this construction is designed to remove only the leading zero (zeros). Try it!
by Yury
31 Oct 2014 05:18
Forum: DOS Batch Forum
Topic: Batch is starting too fast after reboot
Replies: 11
Views: 2133

Re: Batch is starting to fast after reboot

Code: Select all

@echo off

set timeout=60

>nul timeout /nobreak /t %timeout%

::::::::::::::::::::::::::::::::::
by Yury
31 Oct 2014 05:04
Forum: DOS Batch Forum
Topic: Remove zero if file name start with zero batch
Replies: 7
Views: 2178

Re: Remove zero if file name start with zero batch

Code: Select all

@for /f "delims=" %%i in ('dir /a-d/b') do @for /f "tokens=* delims=0" %%j in ("%%i") do @ren "%%i" "%%j"
by Yury
27 Oct 2014 21:38
Forum: DOS Batch Forum
Topic: Trouble Setting Variable in For Loop
Replies: 11
Views: 2123

Re: Trouble Setting Variable in For Loop

<...> or point me in the right direction? setlocal enabledelayedexpansion for /F "tokens=1,2 delims=-" %%G in ('dir /b *.txt') do ( echo Result: %%H set DelimitedFilename=%%H echo DelimitedFilename: !DelimitedFilename! set FourDigitNumber=!DelimitedFilename:~1,4! echo Four Digit Number: !...