Search found 3737 matches

by aGerman
14 Jul 2010 06:40
Forum: DOS Batch Forum
Topic: SET a:b=c won't work
Replies: 16
Views: 6704

Re: SET a:b=c won't work

Using native batch you have to escape all special characters, like ^<>|&. I hope this will work for you: @echo off &setlocal set /p "replace="<"words.txt" for /f "usebackq skip=1 delims=" %%a in ("words.txt") do ( >"%%a.txt" type nul set &quo...
by aGerman
14 Jul 2010 06:18
Forum: DOS Batch Forum
Topic: Need help with FTP Batch
Replies: 2
Views: 1698

Re: Need help with FTP Batch

jojolino I'm not that familar with ftp, but you have to customize the script and maybe you should append a PAUSE command to see what happens. Try something like that: ;@echo off ;set "ftpServer=hostname.com" ;set "uName=YourUserName" ;set "pass=YourPassword" ;set "...
by aGerman
14 Jul 2010 04:46
Forum: DOS Batch Forum
Topic: Need help w/ Recycler.bat
Replies: 6
Views: 2743

Re: Need help w/ Recycler.bat

aseventhmindset Your problem is in this line: if not exist "%temp%\results.vbs" echo msgbox"%killcount% files have been deleted. %deathcount% files could not be deleted.",16,"Recycler" > %temp%\results.vbs If the vbs file exists it will never change. Remove if not exist...
by aGerman
12 Jul 2010 12:22
Forum: DOS Batch Forum
Topic: Ping server & Send mail
Replies: 3
Views: 3592

Re: Ping server & Send mail

You can't send an email by native batch. You could use blat, but you must have access to an email server.

Code: Select all

@echo off &setlocal
ping 192.xxx.xxx.xxx >nul && goto :eof
:: your blat stuff here


Regards
aGerman
by aGerman
12 Jul 2010 11:57
Forum: DOS Batch Forum
Topic: Detecting same file size and deleting
Replies: 6
Views: 2838

Re: Detecting same file size and deleting

If you are sure there are never two files with same size but different contents, you could use this: @echo off &setlocal set rootfolder=c:\your data root pushd "%rootfolder%" ||goto :eof for /d %%a in (*) do ( set "subfolder=%%~fa" call :proc ) popd pause goto :eof :proc push...
by aGerman
12 Jul 2010 11:22
Forum: DOS Batch Forum
Topic: Make a password field
Replies: 1
Views: 1904

Re: Make a password field

There is no way to make a password field in batch. I suggest to write a temporary .hta file to have a separate window for password input. batch file: @ECHO OFF &SETLOCAL &TITLE Password FOR /F "DELIMS=: TOKENS=2" %%i IN ('CHCP') DO SET /A oemcp=%%~ni :start FINDSTR /B /C:" &qu...
by aGerman
11 Jul 2010 15:14
Forum: DOS Batch Forum
Topic: Remove folder once it is empty!!!
Replies: 3
Views: 2504

Re: Remove folder once it is empty!!!

cd\ cd c:\reports\2008 if not exist *.doc goto delete :delete cd\ cd reports rd /S /Q 2008 exit No. If you found no *.doc files you jump to :delete . This is OK, but what happens if *.doc files are found?! The CMD will interprete the next line (it's :delete too). Think about it and correct your cod...
by aGerman
10 Jul 2010 17:12
Forum: DOS Batch Forum
Topic: SET a:b=c won't work
Replies: 16
Views: 6704

Re: SET a:b=c won't work

Nested FOR loops are allowed, but sometimes it is tricky to use them. I didn't try to correct your code, because my mind was drifting to the wrong direction. Your origin replace-line was set new=!old:search=replace! but search and replace are literal expressions in this case. You defined them as var...
by aGerman
10 Jul 2010 11:41
Forum: DOS Batch Forum
Topic: Detecting same file size and deleting
Replies: 6
Views: 2838

Re: Detecting same file size and deleting

Compare and delete files depending on their size is not a good idea. you should use a MD5 tool.

I don't understand what you want to do. Where exactly are the files placed and which of found files should be deleted?

Regards
aGerman
by aGerman
10 Jul 2010 09:33
Forum: DOS Batch Forum
Topic: SET a:b=c won't work
Replies: 16
Views: 6704

Re: SET a:b=c won't work

12 hours? How frustrating! words.txt bad crazy smart template.txt bad little dog walked on a street and saw bad little cats the bad little dog started chasing the bad little cats batch code @echo off &setlocal set /p "replace="<"words.txt" for /f "usebackq skip=1 delims=...
by aGerman
10 Jul 2010 09:21
Forum: DOS Batch Forum
Topic: Help A Desktop script or link to execute a drag-drop file.
Replies: 17
Views: 6788

Re: Help A Desktop script or link to execute a drag-drop fi

Alan When I read your post I wondered why you changed my code starting with "setlocal enabledelayedexpansion". Don't do that. The "!" as variable name doesn't affect the drag'n'dropped batch file, because you use it only into the parent cmd process. And if there is no "setlo...
by aGerman
10 Jul 2010 07:54
Forum: DOS Batch Forum
Topic: SET a:b=c won't work
Replies: 16
Views: 6704

Re: SET a:b=c won't work

I see. words.txt [abc] 111 222 333 [###] crazy smart [def] 444 555 666 template.txt [###] little dog walked on a street and saw [###] little cats the [###] little dog started chasing the [###] little cats batch code @echo off &setlocal set replace=[###] for /f "delims=:" %%i in ('finds...
by aGerman
10 Jul 2010 07:05
Forum: DOS Batch Forum
Topic: SET a:b=c won't work
Replies: 16
Views: 6704

Re: SET a:b=c won't work

The replacement is not needed. If you use square brackets you could split the string with this square brackets as delimiters. words.txt [abc] 111 222 333 [###] one two three [def] 444 555 666 template.txt example [###] batch code @echo off &setlocal for /f "delims=[] tokens=1,2" %%a in...
by aGerman
10 Jul 2010 05:50
Forum: DOS Batch Forum
Topic: Using command from clipboard in batch file
Replies: 4
Views: 4046

Re: Using command from clipboard in batch file

Well, the example on the URL link shows how to do. <obj>.Run "cmd.exe" can open a command prompt <obj>.SendKeys "what ever" will emulate the keyboard The only thing you have to know is that [Ctrl] + [V] doesn't work for a command prompt. You would need [Alt] + [Space], [E], [P]. ...
by aGerman
10 Jul 2010 05:38
Forum: DOS Batch Forum
Topic: Help A Desktop script or link to execute a drag-drop file.
Replies: 17
Views: 6788

Re: Help A Desktop script or link to execute a drag-drop fi

Please explain any benefit of start "%~nx0" cmd /t:1F /k %!% versus start "%~nx0" cmd /t:1F /k "%~1" I see no difference in results, other than whether a variable ! is set There is no difference. %!% is shorter, thats all. I am especially intrigued by the use of a vari...