Search found 4506 matches

by aGerman
28 Nov 2011 17:11
Forum: DOS Batch Forum
Topic: rename problem
Replies: 2
Views: 3047

Re: rename problem

The help for REN is Renames a file or files. RENAME [drive:][path]filename1 filename2. REN [drive:][path]filename1 filename2. Note that you cannot specify a new drive or path for your destination file. The last sentence shows your fault. You must not specify the drive and path in the second argument...
by aGerman
28 Nov 2011 17:04
Forum: DOS Batch Forum
Topic: Variables within ftp txt file, please help
Replies: 2
Views: 3535

Re: Variables within ftp txt file, please help

I'm not familiar with that FTP stuff. For that reason I normally avoid to reply to such topics. But in your case it's obvious why it doesn't work. You have to strictly separate the following: 1. Batch files are interpreted by cmd.exe. The commands in a batch file have nothing to do with the commands...
by aGerman
27 Nov 2011 19:35
Forum: DOS Batch Forum
Topic: encodings
Replies: 11
Views: 18381

Re: encodings

I experimented on my command prompt and found the same behavior: Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. Alle Rechte vorbehalten. C:\windows\system32>prompt $g$s > rem what's the current codepage? > chcp Aktive Codepage: 850. > rem try to paste the registered t...
by aGerman
27 Nov 2011 18:24
Forum: DOS Batch Forum
Topic: [SOLVED] SET /a -- Random Number?
Replies: 24
Views: 35589

Re: [SOLVED] SET /a -- Random Number?

It depends on your locale settings which codepages are used. You will find them in the registry. @echo off &setlocal for /f "tokens=2*" %%i in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Nls\CodePage" /v "OEMCP"') do set /a OEMCP=%%j for /f "tokens=2*&qu...
by aGerman
26 Nov 2011 13:39
Forum: DOS Batch Forum
Topic: Need a help to write a simple c program
Replies: 1
Views: 1879

Re: Need a help to write a simple c program

Hi Ravk.

We always try to help but in your case I couldn't help skipping the reason behind. We won't solve your homework.
Further more this is a Batch forum and C programming is off topic.

Regards
aGerman
by aGerman
26 Nov 2011 13:11
Forum: DOS Batch Forum
Topic: how to process ALL lines of text in a file, including BLANKS
Replies: 6
Views: 5125

Re: how to process ALL lines of text in a file, including BL

Hi Alan. Please explain WHEN the quotes might be needed Well, it's only to protect you from trailing spaces. Your code should work as well, but that wouldn't ... set ln= & set /p ln= ... due to the space between equal sign and ampersand. I'm not sure about your second problem. You could try to w...
by aGerman
24 Nov 2011 16:49
Forum: DOS Batch Forum
Topic: Limit CMD processing to internal commands, safer and faster?
Replies: 16
Views: 20030

Re: Limit CMD processing to internal commands, safer and fas

Interesting attempt :)

@jeb
For some reason it works by creating a "false" PATHEXT environment.

Code: Select all

set "PathExt=$"


Regards
aGerman
by aGerman
22 Nov 2011 13:13
Forum: DOS Batch Forum
Topic: Batch that will run only if another file exists.
Replies: 1
Views: 2754

Re: Batch that will run only if another file exists.

Code: Select all

@echo off
if not exist "aaaa" (
  echo COULD NOT FIND 'aaaa' ABORT.
  pause>NUL
  goto :eof
)
:MENU
echo your stuff here ...
pause

Regards
aGerman
by aGerman
22 Nov 2011 13:05
Forum: DOS Batch Forum
Topic: How to check if parameter is file (or directory)?
Replies: 8
Views: 12200

Re: How to check if parameter is file (or directory)?

Lets say I want to check if a parameter is a file. In this case you could also work with "%~1". If it is a folder or does not exist it should go to the else branch Call this code with a path as (first) parameter or drag/drop a file or folder on it. @echo off &setlocal set $isfile=1&am...
by aGerman
21 Nov 2011 16:37
Forum: DOS Batch Forum
Topic: Macros with parameters appended
Replies: 29
Views: 50630

Re: Macros with parameters appended

Now it dawns me :idea:
Thanks Dave :D

Regards
aGerman
by aGerman
21 Nov 2011 16:12
Forum: DOS Batch Forum
Topic: how to process ALL lines of text in a file, including BLANKS
Replies: 6
Views: 5125

Re: how to process ALL lines of text in a file, including BL

Hi Alan,
Have a look at this technique.
Quote:

Code: Select all

setlocal enableDelayedExpansion
<%file% (
  for /f %%n in ('type %file%^|find /c /v ""') do for /l %%l in (1 1 %%n) do (
    set /p "ln="
    echo(!ln!
    set "ln="
  )
)>%out%
endlocal


Regards
aGerman
by aGerman
21 Nov 2011 16:03
Forum: DOS Batch Forum
Topic: Macros with parameters appended
Replies: 29
Views: 50630

Re: Macros with parameters appended

That's amazing!
I don't understand the behaviour that ^& set argv=, is able to catch the argument but, however, it works just fine.
That's indeed a trigger to commence working with macros. Thanks to each of you three.

Regards
aGerman (still impressed ...)
by aGerman
21 Nov 2011 15:05
Forum: DOS Batch Forum
Topic: help needed with interpreting strings and acting in response
Replies: 46
Views: 32270

Re: help needed with interpreting strings and acting in resp

I need a batch file that finds a text string from a text file (both are internally specified, not user specified) and does something if it is found. If it is not found, the batch file jumps to the next point in the batch file. But it must also set the text next to it on the line as a variable (a st...
by aGerman
20 Nov 2011 17:24
Forum: DOS Batch Forum
Topic: I'm almost done, but now stucked in duplicate check.
Replies: 13
Views: 11160

Re: I'm almost done, but now stucked in duplicate check.

Indention is such a nice thing I absolutely agree. That snippet in indented style ... for /f "tokens=1 delims=" %%G in ('dir /s /b "!fname!\*.*"') do ( set "contents=%%G" if exist "SummaryReport_!petsa!.csv" ( findstr "!contents!" "SummaryRepor...
by aGerman
18 Nov 2011 11:55
Forum: DOS Batch Forum
Topic: need help writing a simple batch file to read a text file
Replies: 1
Views: 1873

Re: need help writing a simple batch file to read a text fil

now here is the tricky part, the third line has to be skipped as well don't know how that would be written, even though this line has "o" in it How should a batch file guess that? the 5th line would need to have a "!" put in front of it since the 5th line is part of the 4th line...