Search found 237 matches

by DosItHelp
22 Dec 2009 00:38
Forum: DOS Batch Forum
Topic: Problem with BatchSubstitute.bat
Replies: 12
Views: 69192

The batch file described at http://www.dostips.com/DtCodeBatchFiles.php#Batch.FindAndReplace has limitations. If the text file to be searched/replaced contains on of the characters &|<> in a line without being quoted then the batch will not process this line correctly. (A proper note has been ad...
by DosItHelp
18 Dec 2009 23:47
Forum: DOS Batch Forum
Topic: How to check if file is busy/locked?
Replies: 2
Views: 7069

There are different states a file can be in: 1. can be renamed but can't be delete. 2. can't be renamed and can't be deleted. To check for the second case you could try to move the file onto itself. move file.txt file.txt 2>NUL >NUL||echo.locked If calling "move /-y file.txt file.txt" (wit...
by DosItHelp
18 Dec 2009 22:31
Forum: DOS Batch Forum
Topic: Renaming file without extra extension at the end...
Replies: 2
Views: 4124

for %%a IN (*.txt) DO rename "%%a" "%%~na.zip"
:wink:
by DosItHelp
18 Dec 2009 22:22
Forum: DOS Batch Forum
Topic: Xcopy /d check
Replies: 2
Views: 4641

One day I got tired of having to lookup the xcopy flags again for a common backup job I had needed and looked up many times before. So I looked one last time: /D (without date) copies only new and newer files. /S Copies directories and subdirectories except empty ones. /C Continues copying even if e...
by DosItHelp
17 Dec 2009 23:48
Forum: DOS Batch Forum
Topic: Output/Redirection Question 1> and 2>
Replies: 5
Views: 7669

squadjot, redirect stderr into stdout in other words: redirect 2 into &1 like this: command >file.txt 2>&1 Note: the order you put the redirection is important: command >file.txt 2>&1 GOOD command 2>&1 >file.txt BAD Some examples: C:\>(echo.good & set /A) good The syntax ...
by DosItHelp
11 Dec 2009 23:56
Forum: DOS Batch Forum
Topic: Help with FOR /D with space in pathname
Replies: 3
Views: 5406

Or put quotes around both the search pattern ("C:\FCTLogs\FirstRun\TestLogs\ABC*") and the substitution variable ("%%i").

Code: Select all

FOR /D %%i IN ("C:\FCTLogs\FirstRun\TestLogs\ABC*") DO RMDIR /S /Q "%%i"

DosItHelp?
by DosItHelp
11 Dec 2009 23:52
Forum: DOS Batch Forum
Topic: SET /P credentials q
Replies: 4
Views: 5912

sxekjb, Here is a related post: http://www.dostips.com/forum/viewtopic.php?p=602 Here is a function you may want to try: http://www.dostips.com/DtCodeCmdLib.php#Function.pwd Basically the best dos solution we found so far is to temporary change the foreground and background color to similar colors (...
by DosItHelp
11 Dec 2009 00:01
Forum: DOS Batch Forum
Topic: ECHO. FAILS to give text or blank line - Instead use ECHO/
Replies: 44
Views: 210529

alan_b, Your finding is quite interesting. I reproduced the issue on a XP box. The problem only seems to happen when a file named "echo" exist in the current directory. I could not see the problem if the file exist in a different directory referenced by the path variable. To try this out I...
by DosItHelp
08 Dec 2009 21:24
Forum: DOS Batch Forum
Topic: FTP list
Replies: 9
Views: 10546

Try:
For /f "usebackq tokens=*" %%i IN ("%FilePath%") DO ( ...
by DosItHelp
07 Dec 2009 20:21
Forum: DOS Batch Forum
Topic: Batch Rename file using Dos Left Function
Replies: 3
Views: 5780

Kris.Mitchell, To get the name of a file without extension simply use "substitution of FOR variable references" like this: @echo off for %%A in (*.*) DO ( echo.convert -density 288 "%%A" +matte -resize 50%% "%%~nA.jpg" ) Type "FOR /?" on a comm...
by DosItHelp
07 Dec 2009 19:56
Forum: DOS Batch Forum
Topic: How to... merge lines?????
Replies: 4
Views: 5721

NetBackUp_Admin, Add more code as you wish right before the first goto:eof. The first goto:eof in avery_larry's code terminates the main part of the batch script, everything you add afterwarts will not directly execute. The second goto:eof you see is the terminator of the :process function he added ...
by DosItHelp
07 Dec 2009 19:39
Forum: DOS Batch Forum
Topic: FTP list
Replies: 9
Views: 10546

May be like this? FTP output dumped into a text file named ftpoutput.txt: ftp> dir 200 PORT command successful. 150 Opening ASCII mode data connection for /bin/ls. 11-19-09 02:39PM 73 10.0.200.50.url 12-03-09 06:02PM <DIR> Folder1 with space 12-01-09 10:47AM <DIR> Folder2 09-14-09 06:25PM <DIR> Fold...
by DosItHelp
06 Dec 2009 03:50
Forum: DOS Batch Forum
Topic: Parameter for FTP username and password
Replies: 1
Views: 4179

gmazza, This may work for you: Use the FTP -s option for your shared login script and at the same time pass the 'real' ftp script (login sequence removed) in via input stream. ftp -i -s:"loginsequence.txt" <realftp1.txt ftp -i -s:"loginsequence.txt" <realftp2.txt ... Or better tr...
by DosItHelp
06 Dec 2009 01:31
Forum: DOS Batch Forum
Topic: FTP list
Replies: 9
Views: 10546

Hey codemonkey, What does the output of the 'dir' command look like on your box when you connect manually? Mine looks like this: ftp> dir 200 PORT command successful 150 Opening ASCII mode data connection for file list -rwxr-xr-x 1 441219 15000 0 Jan 14 2008 .track drwxr-xr-x 2 441219 15000 4096 Dec...
by DosItHelp
03 Dec 2009 23:32
Forum: DOS Batch Forum
Topic: Application Installer with user parameter prompts
Replies: 3
Views: 5004

The menu below discovers the menu items within the batch. It allow adding new menu items as single labeled units without having to change the menu loop itself. @ECHO OFF :menuLOOP echo. echo.= Menu ================================================= echo. for /f "tokens=1,2,* delims=_ " %%A ...