Search found 319 matches

by ghostmachine4
08 Jan 2011 08:51
Forum: DOS Batch Forum
Topic: Referencing Bible Verses Individually
Replies: 14
Views: 12091

Re: Referencing Bible Verses Individually

Mmm... @echo off for /f "tokens=1,* delims=]" %%a in ('find /n /v "" %1') do call :sub "%%b" goto :eof :sub for /f "delims=" %%c in ('echo.%~1^| findstr /rc:[0-9]$') do set "chap=%%c" if "%~1"=="" echo. if "%chap%"==&qu...
by ghostmachine4
08 Jan 2011 08:40
Forum: DOS Batch Forum
Topic: Referencing Bible Verses Individually
Replies: 14
Views: 12091

Re: Referencing Bible Verses Individually

download gawk for windows , and use this one liner C:\test>more file Genesis 1 1 In the beginning . . . . 2 the earth was . . . 3 etc etc Genesis 2 1 Thus the heavens . . . 2 etc etc Exodus 1 1 Now these are the name C:\test>gawk "/^[A-Z]/{s=$0;}/^[0-9]/{print s\".\"$0 }" file Ge...
by ghostmachine4
07 Jan 2011 01:54
Forum: DOS Batch Forum
Topic: Batch Renaming Script
Replies: 4
Views: 5685

Re: Batch Renaming Script

ChickenSoup wrote:This will do it in batch. This assumes that you will not have a file named "Modern Familiy (rerun) (01032011).avi"

Code: Select all

 findstr /r "([1234567890]*)\.avi\


and it also assumes that there are no files like "Modern Family (0).avi"
by ghostmachine4
06 Jan 2011 21:32
Forum: DOS Batch Forum
Topic: Batch Renaming Script
Replies: 4
Views: 5685

Re: Batch Renaming Script

ChickenSoup wrote: This assumes that you will not have a file named "Modern Familiy (rerun) (01032011).avi"

good point. now my code takes care of that.
by ghostmachine4
05 Jan 2011 21:20
Forum: DOS Batch Forum
Topic: Hiding programs run from within a batch script
Replies: 8
Views: 9901

Re: Hiding programs run from within a batch script

Hello, I was wondering how you run a program from inside a batch script whilst keeping the window hidden. I am trying to run programs that are automated tasks - The first commands is for Vista SP2 and the second is for IE7 or above. start /wait %windir%\System32\compcln.exe /quiet start /wait RunDl...
by ghostmachine4
05 Jan 2011 21:04
Forum: DOS Batch Forum
Topic: Alert if files found in a folder are older than X hours
Replies: 9
Views: 11546

Re: Alert if files found in a folder are older than X hours

I really liked tips for date and time but I wanted to know if its possible to write a script that can be run to monitor a folder and to generate an alert if files found in the folder are older than X amount of hours rather than amount of days in one of the examples given. download findutils for win...
by ghostmachine4
05 Jan 2011 19:57
Forum: DOS Batch Forum
Topic: Batch Renaming Script
Replies: 4
Views: 5685

Re: Batch Renaming Script

download gawk for windows and do this BEGIN{ q="\042" # double quote } { o=$0 match ( $0 , /\([ \t]*[0-9]{8}[ \t]*\)/, a ) date = substr($0, RSTART, RLENGTH) gsub(/\(|\)| /,"",date); date=substr(date,0,2)"."substr(date,3,2)"."substr(date,5) $0 = substr(o,0,RST...
by ghostmachine4
05 Jan 2011 17:57
Forum: DOS Batch Forum
Topic: Upload files on FTP
Replies: 2
Views: 4012

Re: Upload files on FTP

Hello, I have some questions about a script I found here that I have been using, this is the script: @ftp -i -s:"%~f0"&GOTO:EOF <--- What does this line do? open 31.359.58.107 test test !:--- FTP commands below here --- ascii <--- Why use Ascii here? Is it depending on the files that ...
by ghostmachine4
04 Jan 2011 23:38
Forum: DOS Batch Forum
Topic: Output to text file
Replies: 13
Views: 15548

Re: Output to text file

get a good file parsing tool, like gawk for windows.

Code: Select all

C:\test> cert -v .....  | gawk "/CERT.*_ID\(20\)/{getline;print}" 
by ghostmachine4
02 Jan 2011 00:05
Forum: DOS Batch Forum
Topic: BasicInfo
Replies: 26
Views: 21539

Re: BasicInfo

aGerman wrote:No. This is matching lines that contain IP or Address or IPv4.
IPv4 is useless then, it contains IP ....

I regret not using my favourite grep/gawk .

Code: Select all

ipconfig /all | grep -E "(IP|IPv4) Address"
by ghostmachine4
01 Jan 2011 00:24
Forum: DOS Batch Forum
Topic: BasicInfo
Replies: 26
Views: 21539

Re: BasicInfo

there's no need to call ipconfig 2 times. Do something to the find ( or rather use findstr) to make it search for those 2 patterns at the same time. ghostmachine4, I'm new to using findstr. Could you present an example of the better way to do it? ipconfig .... | findstr /I "IP Address IPv4&quo...
by ghostmachine4
30 Dec 2010 18:54
Forum: DOS Batch Forum
Topic: BasicInfo
Replies: 26
Views: 21539

Re: BasicInfo

You may need it like this to account for both XP and 7. I do all my tests on Windows XP: SETLOCAL ENABLEEXTENSIONS SETLOCAL ENABLEDELAYEDEXPANSION set mynum=1 REM.-- your code goes here echo.Hello World for /f "tokens=2 delims=:" %%a in ('ipconfig /all^|find /i "IP Address"') do...
by ghostmachine4
29 Dec 2010 09:40
Forum: DOS Batch Forum
Topic: Problem with BatchSubstitute.bat
Replies: 12
Views: 70152

Re: Problem with BatchSubstitute.bat

I also found the BatchSubstitute.bat really useful - Thank you. Is there a way it can be modified to except regular expressions, such as /.*$ (to get all from a / to the end of the line)? I have tried modifying BatchSubstitute.bat for findstr /R, but I break it each time I touch it (i'm sort of new...
by ghostmachine4
29 Dec 2010 00:15
Forum: DOS Batch Forum
Topic: Batch Encrypt
Replies: 2
Views: 4070

Re: Batch Encrypt

Hello everyone! This is my first post (So please don't start a flame wars ><) I'm working on a batch encrypter in Visual Basic, It works good and it won't display all the information when somebody adds: @ECHO OFF ECHO <Your encrypted Code> So I wanted to find out if anyone is interested? I Thought ...
by ghostmachine4
28 Dec 2010 08:56
Forum: DOS Batch Forum
Topic: Help with Batch / VBScript
Replies: 20
Views: 18838

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: @echo off &setlocal for /f "delims=" %%a in ('dir /a-d /b *.txt') do ( cscript //nologo "replacer.vbs" "%%~a" ) pause Regards aGerman that would be too inefficient. Yo...