Search found 1983 matches

by penpen
31 Jul 2013 13:02
Forum: DOS Batch Forum
Topic: Inserting DNS name of each IP address in WWW log files
Replies: 12
Views: 10966

Re: Inserting DNS name of each IP address in WWW log files

This is untested (programmed it on my mobile phone): @ECHO OFF setlocal enableDelayedExpansion set "log=stunnel.log" set "logx=stunnelx.log" set "logt=stunnel.log.temp" findstr /I /V /C:"127.0.0" /C:"192.168" /C:"byte" /C:"WSAECONNRESE...
by penpen
31 Jul 2013 11:58
Forum: DOS Batch Forum
Topic: Inserting DNS name of each IP address in WWW log files
Replies: 12
Views: 10966

Re: Inserting DNS name of each IP address in WWW log files

The syntax error is caused by the position of the Label. The next command then is: ) > "%logx%" which is obviously an error. I also assume, that the Label is at the wrong position anyway, as it should be within the for loop. But this won't work anyway, because a goto breaks the loop: @echo...
by penpen
29 Jul 2013 12:14
Forum: DOS Batch Forum
Topic: Batch file edit text file
Replies: 20
Views: 55218

Re: Batch file edit text file

Yes, it is working fine. The only thing, that might happen is, that the reg file on some systems may be exported using Unicode. To avoid this, as Unicode is not supported, you should transform it to ANSI/ASCII: ::Export the key reg.exe export "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Cri...
by penpen
29 Jul 2013 01:07
Forum: DOS Batch Forum
Topic: Inserting DNS name of each IP address in WWW log files
Replies: 12
Views: 10966

Re: Inserting DNS name of each IP address in WWW log files

This should fix the problems: @echo off setlocal enableDelayedExpansion set "log=stunnel log\stunnel.log" set "logx=stunnelx.log" ( for /f "tokens=1-3* usebackq delims= " %%a in ("%log%") do ( set "dateValue=%%a" set "dateValue=!dateValue:~5,2!/...
by penpen
28 Jul 2013 16:56
Forum: DOS Batch Forum
Topic: Batch file edit text file
Replies: 20
Views: 55218

Re: Batch file edit text file

Removed the bugs with empty lines. It now should work with blank lines, too. Note you cannot use the = character in replace variable, all other should work. :: Source.txt example This is something from all. This is something from all. This is something from all. Nothing follows. This is something fr...
by penpen
28 Jul 2013 15:45
Forum: DOS Batch Forum
Topic: Batch file edit text file
Replies: 20
Views: 55218

Re: Batch file edit text file

Sorry i didn't test it.
I've corrected the code above, and it should work now.

penpen
by penpen
28 Jul 2013 12:50
Forum: DOS Batch Forum
Topic: password protect
Replies: 5
Views: 6571

Re: password protect

Just found this to set a password to a folder:
http://social.microsoft.com/Forums/en-US/9a0f17af-928e-4732-a3ba-90d54ed961ea/lock-folder-without-any-software
To make it more safe, just store the password in a textfile, that is hidden, too.

penpen
by penpen
28 Jul 2013 12:25
Forum: DOS Batch Forum
Topic: Batch file edit text file
Replies: 20
Views: 55218

Re: Batch file edit text file

In many cases something like this suffices: @echo off set "replace=something" set "replaced=different" set "source=Source.txt" set "target=Target.txt" setlocal enableDelayedExpansion ( for /F "tokens=1* delims=:" %%a in ('findstr /N "^" %so...
by penpen
28 Jul 2013 12:06
Forum: DOS Batch Forum
Topic: Inserting DNS name of each IP address in WWW log files
Replies: 12
Views: 10966

Re: Inserting DNS name of each IP address in WWW log files

If the (ip address, port) pair is always at the end of each line, if present, then you may do something like this to process all lines: @echo off setlocal enableDelayedExpansion set "log=stunnel.log" set "logx=stunnelx.log" ( for /f "tokens=1-3* delims= " %%a in (%log%)...
by penpen
28 Jul 2013 11:46
Forum: DOS Batch Forum
Topic: hide while doing robocopy
Replies: 1
Views: 2838

Re: hide while doing robocopy

Just do:

Code: Select all

attrib +H "%~d0\DATA"
:: insert your code here
attrib -H "%~d0\DATA"

penpen
by penpen
27 Jul 2013 15:56
Forum: DOS Batch Forum
Topic: import Outlook Express 6 "Internet-Accounts"
Replies: 4
Views: 6134

Re: import Outlook Express 6 "Internet-Accounts"

I think, there is no way to export registry values of type REG_BINARY as ASCII. But you may parse it somehow like this to ASCII after you have exported it: @echo off setlocal set ASCII= ^^^ ^^^ ^^^!^^^"^^^#^^^$%%%%^^^&^^^'^^^(^^^)^^^*^^^+^^^,^^^-^^^.^^^/^^^0^^^1^^^2^^^3^^^4^^^5^^^6^^^7^^^8^...
by penpen
25 Jul 2013 13:08
Forum: DOS Batch Forum
Topic: xcopy help
Replies: 5
Views: 5736

Re: xcopy help

I don't understand, what you want to do. If you use the command lines: xcopy /-y C:\Users\David\Desktop\batch\1\* /e C:\Users\David\Desktop\batch\2 pause then the originals are in C:\Users\David\Desktop\batch\1, and the duplicates are in C:\Users\David\Desktop\batch\2. So keeping the duplicates is j...
by penpen
25 Jul 2013 12:32
Forum: DOS Batch Forum
Topic: Rename Command
Replies: 7
Views: 7224

Re: Rename Command

Putting all together and shortening :D then results in:

Code: Select all

rename "path\Video*" " imag*" & for /f "tokens=* delims= " %a in ('dir "path\ imag*" /b') do rename "path\ %~nxa" "%~nxa"

penpen
by penpen
25 Jul 2013 10:38
Forum: DOS Batch Forum
Topic: import Outlook Express 6 "Internet-Accounts"
Replies: 4
Views: 6134

Re: import Outlook Express 6 "Internet-Accounts"

The Outlook Express 6 Settings are located in the registry key: HKCU\Software\Microsoft\Internet Account Manager\ And the accounts should be in: HKCU\Software\Microsoft\Internet Account Manager\Accounts\00000001 HKCU\Software\Microsoft\Internet Account Manager\Accounts\00000002 HKCU\Software\Microso...
by penpen
25 Jul 2013 03:52
Forum: DOS Batch Forum
Topic: Running batch file from shared out folder
Replies: 7
Views: 8862

Re: Running batch file from shared out folder

Just figured out that the batch file is trying to change directories on my local computer instead of the remote computer. Does anyone have experience calling a batch file from a file share? I fear that calling this batch file from a share wouldn't help you, as your batch affects your computer no ma...