Search found 4316 matches
- 04 Jan 2012 07:34
- Forum: DOS Batch Forum
- Topic: Determining the number of lines in a file.
- Replies: 50
- Views: 42490
Re: Determining the number of lines in a file.
I gave it a try with a very small file (in my world) of 25,012 lines and a line length of 1026. I ran it with an EOL of LF and received the ERROR: Invalid file format. I then ran the file through an EOL Converter and changed the EOL to CRLF. Ran the batch file again and received the same ERROR: Inva...
- 04 Jan 2012 06:36
- Forum: DOS Batch Forum
- Topic: delete 2 days older folders
- Replies: 18
- Views: 17015
Re: delete 2 days older folders
1. m - D-daY 100% calculation 2. m - week Mon Tue Wed Thu Fri Sat Sun file make day - to 2 week day today monday - 2day = satday max day 6day delete 3. windows server type command 2 line command end @echo off FORFILES /D -2 /m filesname exsemple forfiles /P D:\backup\WEB_SOURCE\2010\ /D -7 /C "...
- 03 Jan 2012 22:13
- Forum: DOS Batch Forum
- Topic: A dos version of unix which command
- Replies: 13
- Views: 12475
Re: A dos version of unix which command
That is precisely the expected behavior. The whole point is to determine what will be executed if an attempt is made to invoke a given executable such as "notepad" from the current directory. I suppose that does make sense. For some reason I was thinking he did want to find the paths to a...
- 03 Jan 2012 22:03
- Forum: DOS Batch Forum
- Topic: Determining the number of lines in a file.
- Replies: 50
- Views: 42490
Re: Determining the number of lines in a file.
Hi Dave, I will give this a try at work tomorrow. Lots of code to look at and I wan't to make sure I understand it. I was just thinking about using the Modulus to figure out if the record length is correct. set /A numlines=%filesize%%%%(%linelength%+2) example: set /A temp=100000%(998+2) This would ...
- 03 Jan 2012 21:28
- Forum: DOS Batch Forum
- Topic: create dir with text file in it
- Replies: 3
- Views: 4264
Re: create dir with text file in it
I believe they want the XML code written to the file %%L\%%L.DVD.DISC
- 03 Jan 2012 21:20
- Forum: DOS Batch Forum
- Topic: A dos version of unix which command
- Replies: 13
- Views: 12475
Re: A dos version of unix which command
Shouldn't this code find the file in all directories within your path? It only seems to find it in the first directory within the path. @ECHO OFF SETLOCAL ENABLEDELAYEDEXPANSION SET NAMEEXT=!PATHEXT:.=%1.! FOR %%N IN (%NAMEEXT%) DO IF NOT "%%~$PATH:N" == "" ECHO %%~$PATH:N Notep...
- 03 Jan 2012 21:00
- Forum: DOS Batch Forum
- Topic: A dos version of unix which command
- Replies: 13
- Views: 12475
Re: A dos version of unix which command
I have always been partial to WHEREIS
- 03 Jan 2012 13:59
- Forum: DOS Batch Forum
- Topic: Determining the number of lines in a file.
- Replies: 50
- Views: 42490
Re: Determining the number of lines in a file.
Getting a little further along now that I am at work I am now testing with a file of 1026 bytes and it seems to work regardless of the EOL being a CRLF or just a LF. Problem is I am never stripping the Number and Colon that the FINDSTR command adds yet my length count comes out to 1026. I have no cl...
- 03 Jan 2012 11:49
- Forum: DOS Batch Forum
- Topic: A dos version of unix which command
- Replies: 13
- Views: 12475
Re: A dos version of unix which command
Not sure why I did that first set statement. You can do the string replacement in the FOR LOOP.
Code: Select all
FOR %%a in (%PATHEXT:;= %) do call :function "%~1%%~a"
- 03 Jan 2012 11:40
- Forum: DOS Batch Forum
- Topic: List Directory with time stamp
- Replies: 2
- Views: 3549
Re: List Directory with time stamp
Code: Select all
for /f "tokens=*" %%I in ('dir /a-d /b /s *.xls') do echo %%~dpnxI,%%~tI >>filelist.csv
- 03 Jan 2012 11:30
- Forum: DOS Batch Forum
- Topic: A dos version of unix which command
- Replies: 13
- Views: 12475
Re: A dos version of unix which command
I think you would want to do it this way.
Code: Select all
set myext=%PATHEXT:;= %
FOR %%a in (%myext%) do call :function "%~1%%~a"
- 03 Jan 2012 07:22
- Forum: DOS Batch Forum
- Topic: PROBLEM
- Replies: 4
- Views: 5402
Re: PROBLEM
And as I learned just not too long ago from Dave, the SET /P option limits the user input to 1024 characters. With a minimum of 150 words you could easily hit that limit.
You might be better off with a VBscript option.
You might be better off with a VBscript option.
- 03 Jan 2012 07:17
- Forum: DOS Batch Forum
- Topic: What is FORFILES good for
- Replies: 5
- Views: 5457
Re: What is FORFILES good for
I guess I just use it mostly for the /D option.
- 02 Jan 2012 19:38
- Forum: DOS Batch Forum
- Topic: Determining the number of lines in a file.
- Replies: 50
- Views: 42490
Re: Determining the number of lines in a file.
What if we did something like this in a function. findstr /n . "testfile.txt" | findstr "^1:" &GOTO :EOF When you execute this code it outputs the first line pretty quickly and then exits. Not sure if this can be implemented into a For Loop and still get the first line captur...
- 02 Jan 2012 17:37
- Forum: DOS Batch Forum
- Topic: Display a SecurityCenter status overview
- Replies: 10
- Views: 13053
Re: Display a SecurityCenter status overview
Did you read this on Rob's website.
Use WBEMTEST.EXE to find all properties for a specific AntiVirus or Firewall product.