Search found 968 matches

by jeb
26 Jan 2009 16:39
Forum: DOS Batch Forum
Topic: Extract rows from text file and slight reformatting
Replies: 10
Views: 8189

Hi NTYeader, it's nice that your code works finally. Your minor problem is not a problem. setlocal ENABLEDELAYEDEXPANSION for /l %%d in (1,1,30) do ( REM ensures two digits if %%d lss 10 ( set dd=0%%d ) else ( set dd=%%d ) echo dd=!dd! ) Works fine. Or you can solve i...
by jeb
20 Jan 2009 09:20
Forum: DOS Batch Forum
Topic: How to block the first or the last line of the output screen
Replies: 1
Views: 3120

Hi tanoloco, similiar to the Problem from ntyReader, but a bit easier, because of the fixed count of one line removing from the tail and the head. @ECHO off setlocal ENABLEDELAYEDEXPANSION set /a show=0 for /F "tokens=* skip=1" %%r in (test.txt) do ( if !show!==1 echo !saveLine...
by jeb
19 Jan 2009 13:33
Forum: DOS Batch Forum
Topic: Compare Strings
Replies: 2
Views: 4248

Hi osramos, the findstr seems to be the right way. But then you have to use the output and split it with the FOR /F "tokens=..." command. Somthing like FOR /F "tokens=7" %%a in ('findstr "attempted" myFile.tmp') do set att=%%a FOR /F "tokens=7" %%c in ...
by jeb
19 Jan 2009 08:35
Forum: DOS Batch Forum
Topic: Help - How to find a character position in a string
Replies: 1
Views: 3263

Hi ibexcentral,

read the forum and you will find it.

Title: "Find index of substring or character in string."

jeb

[/url]
by jeb
18 Jan 2009 15:00
Forum: DOS Batch Forum
Topic: Extract rows from text file and slight reformatting
Replies: 10
Views: 8189

Hi NTY, so I try to find a hint. I build my own tmp.csv remark 1 remark 2 remark ... remark N City,Visits Hamburg,1 Berlin,8 Bochum,1000 This is the end, but should not used For /F %%A in ('Find /V /C "City,Visits" tmp.csv') Do set FR=%%A First, I tried "Find /V /C" and i...
by jeb
18 Jan 2009 14:11
Forum: DOS Batch Forum
Topic: Passing argument to DOS script containing a quote
Replies: 1
Views: 4951

Hi Harlod, simple if you use only one argument like the password. Then you can use %* for all the input. But if you use two arguments, like user and pwd, then it becomes complicated. The first argument is obviously %1, but the SHIFT command fail for %*. %* reflects always all arguments, not modified...
by jeb
12 Jan 2009 13:12
Forum: DOS Batch Forum
Topic: Variable Question
Replies: 4
Views: 4687

Hi Cander, hmm. The idea here was to get the connect1's variable value "1243" into the variable value? That's my intention. What does the triple %%% do? Why the call? The triple %%%, read it as (%%)%str%(%%), the rule is: %% will "expand" to a single % without any other meaning, ...
by jeb
05 Jan 2009 17:19
Forum: DOS Batch Forum
Topic: Parse path into drive/directory/file
Replies: 4
Views: 4395

Hi jpeg, look at the help of FOR (for /?), there is the substitution explained. setlocal set str=c:\parentdir\childdir\filename.ext call :split %str% goto :eof :split echo drive=%~d1 path=%~p1 name=%~n1 ext=%~x1 goto :eof Results to drive=c: path=\parentdir\childdir\ name=filename ext=.ext jeb
by jeb
05 Jan 2009 17:13
Forum: DOS Batch Forum
Topic: Variable Question
Replies: 4
Views: 4687

Hi Cander,

try this for indirect variable access

Code: Select all

set connect1=1243
set str=connect1

call set value=%%%str%%%
echo %value%


jeb
by jeb
05 Jan 2009 17:05
Forum: DOS Batch Forum
Topic: Relative path for subdirectories from dir command?
Replies: 4
Views: 9520

Hi, you got it, but you missed some few characters. I tested this and it seems to works. setlocal enabledelayedexpansion for /F "tokens=*" %%c in ('dir *.bmp /a-d /ogn /b /s') do ( set abspath=%%~fc call set "relpath=%%abspath:%cd%\=%%" rem echo abs=!abspath! rel=!rel...
by jeb
04 Jan 2009 18:15
Forum: DOS Batch Forum
Topic: Relative path for subdirectories from dir command?
Replies: 4
Views: 9520

Hi JubaJuba, look at :MakeRelative from the Function Library, use it with an absolute path to your file and it should work. for /F "tokens=*" %%c in ('dir *.jpg;*.bmp /a-d /ogn /b') do ( set filename=%%~fc call :MakeRelative filename echo ^<img^>!filename!^<^/img^> >> list.xml ...
by jeb
04 Jan 2009 18:07
Forum: DOS Batch Forum
Topic: Extract rows from text file and slight reformatting
Replies: 10
Views: 8189

Hi NYTReader123, try to use the FOR statement to extract single lines from the file. for /f "tokens=*" %%a in (tmp.csv) do @echo %%a But first you have to simple count the number of lines (also with the FOR), then it should be simple. Then you start a second FOR-run and append your...
by jeb
04 Jan 2009 17:59
Forum: DOS Batch Forum
Topic: Find index of substring or character in string.
Replies: 2
Views: 12109

Hi lstewart, try this setlocal set str=abcdefghijklmnopqrstuvxyz call :indexOf result "%str%" "e" echo %result% goto :eof :::::::::::::::::::::::::::::::::::::::::::::::::::: :indexOf <resultVar> <str> <find> SETLOCAL set "str=%~2" call set "part=%%str:%~3=&rem...
by jeb
04 Jan 2009 17:36
Forum: DOS Batch Forum
Topic: Moving files inside a folder
Replies: 1
Views: 3497

Hi BatchFileCommand,

do you get an error message?

Try to quote it, there could be spaces in the path to the Desktop

Code: Select all

move /-Y "%homedrive%\%homepath%\Desktop\File,..." HyperFolder


Hope it helps
jeb
by jeb
05 Dec 2008 04:59
Forum: DOS Batch Forum
Topic: Current line number being executed
Replies: 2
Views: 4571

Hi Jeff, I suppose there is no simple sulotion for __LINE__, but I use a pseudo line function for error messages like "Error in line 123: Invalid parameter". @echo off setlocal enableextensions rem setlocal enabledelayedexpansion if "%~1"=="" ( call :echoLine "...