Search found 397 matches

by miskox
06 Aug 2010 12:17
Forum: DOS Batch Forum
Topic: help - replace multiple strings from a file in another file
Replies: 11
Views: 12791

Re: help - replace multiple strings from a file in another f

Though I prefer native batch (to be completely independent) sometimes it just can't handle complex strings. I use gsar (just google for it). You can replace *every* character using HEX/DEC codes.

Saso
by miskox
02 Aug 2010 07:36
Forum: DOS Batch Forum
Topic: Get only first row for each file
Replies: 10
Views: 9565

Re: Get only first row for each file

Even shorter:

Code: Select all

@echo off
set "outstr="
for /f "delims=" %%i in (a.a) do if not defined outstr set outstr=%%i
echo.%outstr%


Saso
by miskox
02 Aug 2010 06:58
Forum: DOS Batch Forum
Topic: Need help with a Script
Replies: 1
Views: 2050

Re: Need help with a Script

Code: Select all

if "%a%"=="1" goto Background
if "%a%"=="2" goto Script
if "%a%"=="3" goto Quit


Saso
by miskox
02 Aug 2010 06:55
Forum: DOS Batch Forum
Topic: Get only first row for each file
Replies: 10
Views: 9565

Re: Get only first row for each file

@echo off set /a tmpmatch=0 for /f "delims=" %%i in (a.a) do call :0 "%%i" echo.%outstr% goto :EOF :0 if "%tmpmatch%"=="0" set "outstr=%~1" && set /a tmpmatch=1 goto :EOF File a.a is your input .txt file. Line echo.%outstr% displays a string...
by miskox
30 Jul 2010 13:01
Forum: DOS Batch Forum
Topic: Opening a file in a different folder
Replies: 16
Views: 8719

Re: Opening a file in a different folder

I would suggest you do this: echo on pushd bin if /i "%classname%"=="BeerSong" ( >"%dp~0%classname%.txt" 2>&1 java %classname% start "" "%dp~0%classname%.txt" pause ) else ( java %classname% pause ) popd pause This should wait everywhere. And whe...
by miskox
30 Jul 2010 07:52
Forum: DOS Batch Forum
Topic: Removing quotes...
Replies: 12
Views: 7590

Re: Removing quotes...

Thanks, aGerman.

I used this:

Code: Select all

set "y=%~1"


This does exactly what I want.

Thanks again.
Saso
by miskox
26 Jul 2010 05:57
Forum: DOS Batch Forum
Topic: In line command (Processus startup postponed)
Replies: 3
Views: 3329

Re: In line command (Processus startup postponed)

Code: Select all

@sleep 60 && D:\PM10\DEBUG\START D:\PM10\DEBUG\CEMeasAvg.exe 127.0.0.1 D:\PM10\Ce_LHC8.txt


Is this it?

Saso
by miskox
26 Jul 2010 04:35
Forum: DOS Batch Forum
Topic: [TIP] Checking for open/locked files.
Replies: 0
Views: 3227

[TIP] Checking for open/locked files.

I was reading this http://www.dostips.com/DtTipsXCopy.php and there is something about locked files.

Another method which I am using is a move command:

Code: Select all

move /y a.a a.a >nul 2>nul


returns ERRORLEVEL 1 if file is locked, 0 if not locked.

Saso
by miskox
26 Jul 2010 04:32
Forum: DOS Batch Forum
Topic: Removing quotes...
Replies: 12
Views: 7590

Removing quotes...

I have a string:

Code: Select all

set tmpstring="String with ^^ character"


Question: how to remove quotes but ^^ should remain there. If I use %~ then one ^ gets removed.

Thanks,
Saso
by miskox
26 Jul 2010 04:27
Forum: DOS Batch Forum
Topic: echo <FF> (to screen or a file)
Replies: 7
Views: 5935

Re: echo <FF> (to screen or a file)

Thanks Jeb. I did check that - but I admit - too complex for me. For now there is no solution.
This problem does not have a highest priority at the moment.

Thanks,
Saso
by miskox
26 Jul 2010 04:26
Forum: DOS Batch Forum
Topic: I want to create a batch file (.bat) that changes [file name
Replies: 4
Views: 4229

Re: I want to create a batch file (.bat) that changes [file

I agree with phillid.

aGerman was not doing anything wrong. He just warns against the 'file locked' conflict.

Saso
by miskox
22 Jul 2010 07:59
Forum: DOS Batch Forum
Topic: echo <FF> (to screen or a file)
Replies: 7
Views: 5935

echo <FF> (to screen or a file)

Hi all, I would like to echo a FORMFEED control code to a screen (or a file). echo X* causes me problems because NOTEPAD does not like x0C (wants to save a file in Unicode). If I save it as ANSI I get a plus (+) sign. * replace X with an ALT+12 on the numeric keypad so you get a FORMFEED control cod...
by miskox
19 Jul 2010 03:19
Forum: DOS Batch Forum
Topic: Randomly generated file names
Replies: 4
Views: 3517

Re: Randomly generated file names

Replace

Code: Select all

set "oldname=<oldname.txt"


with

Code: Select all

FOR /F %%i IN (oldname.txt) DO set oldname=%%i


Saso
by miskox
12 Jul 2010 06:34
Forum: DOS Batch Forum
Topic: Detecting same file size and deleting
Replies: 6
Views: 4179

Re: Detecting same file size and deleting

I would suggest using fc /b file1 file2 >nul 2>nul for this. I have a batch file for finding .pdf files from different (sub)folders and I compare them with .pdf files that are located in ONE folder only. But files in (sub)folders have different filenames than the one in ONE folder. I make a list of ...
by miskox
01 Jul 2010 01:08
Forum: DOS Batch Forum
Topic: How to pickup null value in variable
Replies: 3
Views: 3254

Re: How to pickup null value in variable

aGerman always supplies complete answers. Maybe in one line you need this:

Code: Select all

if "%input%"=="" echo Empty string entered.


Hope this helps.

Saso