Search found 4564 matches

by aGerman
29 Dec 2010 20:40
Forum: DOS Batch Forum
Topic: batch file help
Replies: 7
Views: 8071

Re: batch file help

Yeah, there is a big difference between the old errorlevel handling and the new (since cmd.exe) %errorlevel% variable. From the help for IF: [...] IF [NOT] ERRORLEVEL number command [...] ERRORLEVEL number Specifies a true condition if the last program run returned an exit code equal to or greater t...
by aGerman
29 Dec 2010 17:10
Forum: DOS Batch Forum
Topic: Need help with :echo function
Replies: 9
Views: 7636

Re: Need help with :echo function

You're welcome. I like to share the things I made. :wink:

Regards
aGerman
by aGerman
29 Dec 2010 17:01
Forum: DOS Batch Forum
Topic: batch file help
Replies: 7
Views: 8071

Re: batch file help

Prezident wrote:if errorlevel 0 (

No. This will always be true, because the meaning is "if errorlevel is 0 or greater than 0".

You could use
if %errorlevel%==0 (
instead.

Regards
aGerman
by aGerman
29 Dec 2010 15:38
Forum: DOS Batch Forum
Topic: Problem with BatchSubstitute.bat
Replies: 12
Views: 80635

Re: Problem with BatchSubstitute.bat

Code: Select all

strLine = Replace(strLine, "PT", "")

Otherwise give an example line and show what you try to do.

Regards
aGerman
by aGerman
29 Dec 2010 14:50
Forum: DOS Batch Forum
Topic: Batch script to Copy most recently created nonzero byte file
Replies: 2
Views: 4683

Re: Batch script to Copy most recently created nonzero byte

Try something like that:

Code: Select all

for /f "tokens=*" %%a in ('dir /b /od 2^>NUL') do (
  if "%%~za" neq "0" set latest=%%a
)


Regards
aGerman
by aGerman
29 Dec 2010 14:39
Forum: DOS Batch Forum
Topic: Need help with :echo function
Replies: 9
Views: 7636

Re: Need help with :echo function

OK, I'm a member of another website with a c++ forum.
Try:
http://www.lingubender.com/forum/viewtopic.php?f=5&t=833

Regards
aGerman
by aGerman
29 Dec 2010 12:56
Forum: DOS Batch Forum
Topic: FTP Directory
Replies: 4
Views: 5788

Re: FTP Directory

Such things are terrible with ftp. You could redirect the dir-output to a file and then process it. @echo off &setlocal set "ftpHost=ftpHost.com" set "ftpUser=yourUserName" set "ftpPwd=yourPassword" set "ftpRemoteDir=HTDOCS" ( echo open %ftpHost% echo %ftp...
by aGerman
29 Dec 2010 10:59
Forum: DOS Batch Forum
Topic: drives
Replies: 11
Views: 12977

Re: drives

Well then a simple double click should run the script. Didn't you try it?

Regards
aGerman
by aGerman
29 Dec 2010 08:45
Forum: DOS Batch Forum
Topic: Problem with BatchSubstitute.bat
Replies: 12
Views: 80635

Re: Problem with BatchSubstitute.bat

Yeah I think VBScript is a better way to handle regex patterns, but vbs is kinda off topic in this forum. How ever, have a look at the msdn. It shows how to do.

Regards
aGerman
by aGerman
29 Dec 2010 08:36
Forum: DOS Batch Forum
Topic: FTP Directory
Replies: 4
Views: 5788

Re: FTP Directory

I don't use ftp, but probably the (ftp-)dir command can do it for you. The permissions show if it is a file or a directory.

Regards
aGerman
by aGerman
29 Dec 2010 08:28
Forum: DOS Batch Forum
Topic: Need help with :echo function
Replies: 9
Views: 7636

Re: Need help with :echo function

Well, the first tool that resized your window is debug.exe. It acts as assembler to create the .com files. You could avoid it if you start debug.exe in a separate minimized window. :: ... echo.q )>%temp%\col.asm start "" /min /wait cmd /c "debug<%temp%\col.asm" "%com%" ...
by aGerman
28 Dec 2010 10:15
Forum: DOS Batch Forum
Topic: Help
Replies: 6
Views: 7017

Re: Help

@echo off setlocal enabledelayedexpansion :: Change to your path: set "rootFolder=C:\whereever\test" echo ---- echo Menu: echo ---- cd /d "%rootFolder%" set /a n=0 for /f "delims=" %%a in ('dir /ad /b') do ( set /a n+=1 set "f_!n!=%%~a" echo !n!- %%~a ) :erro...
by aGerman
28 Dec 2010 10:02
Forum: DOS Batch Forum
Topic: Help with Batch / VBScript
Replies: 20
Views: 25435

Re: Help with Batch / VBScript

I would NEVER(!!!!) try to do that. 1. The script works only for files with PLAIN TEXT contents. 2. You never know what happens if you replaced something and then is something else not working. Which of the thousands of changed files coused the error? BTW ghostmachine4 is absolutly right. If you hav...
by aGerman
28 Dec 2010 08:35
Forum: DOS Batch Forum
Topic: Help with Batch / VBScript
Replies: 20
Views: 25435

Re: Help with Batch / VBScript

No, vbs accepts no wildcard (*). But you can call it with each found txt file in a FOR loop.
Try:

Code: Select all

@echo off &setlocal
for /f "delims=" %%a in ('dir /a-d /b *.txt') do (
  cscript //nologo "replacer.vbs" "%%~a"
)
pause


Regards
aGerman
by aGerman
28 Dec 2010 08:06
Forum: DOS Batch Forum
Topic: Help
Replies: 6
Views: 7017

Re: Help

Try: @echo off setlocal enabledelayedexpansion set "f_1=Folder 1" set "f_2=Folder 2" set "f_3=anotherFolder" echo ---- echo Menu: echo ---- echo 1- %f_1% echo 2- %f_2% echo 2- %f_3% :errorLoop set "num=" set "selectedFolder=" set /p "num= Select...