Search found 4506 matches
- 01 Dec 2010 13:08
- Forum: DOS Batch Forum
- Topic: please explain me this
- Replies: 1
- Views: 2757
Re: please explain me this
This method is not safe. Check the output of echo %date% If you find something like ... Wed 12/01/2010 ... it would work for you. The next 2 characters after the 4th is the month. The next 2 characters after the 7th is the day. The last 4 characters is the year. For additional informations type SET ...
- 01 Dec 2010 12:56
- Forum: DOS Batch Forum
- Topic: Set a variable
- Replies: 3
- Views: 3885
Re: Set a variable
Try this line: for /f "tokens=2,3 delims=:" %%i in ('find /c "SearchString" "file.ext"') do if "%%j"=="" (set /a var=%%i) else set /a var=%%j The number of lines should be in %var% now. But do you realy mean it is a good idea to use this in .net? Reg...
- 01 Dec 2010 12:35
- Forum: DOS Batch Forum
- Topic: Batch File to Replace String in Text File
- Replies: 8
- Views: 36280
Re: Batch File to Replace String in Text File
Because of the special characters (< and >) I suggest don't use pure batch for the replacement. Have a look at this.
Regards
aGerman
Regards
aGerman
- 01 Dec 2010 12:28
- Forum: DOS Batch Forum
- Topic: delete folder starting with number
- Replies: 2
- Views: 3851
Re: delete folder starting with number
Try something like that: @echo off &setlocal pushd "C:\your\directory" ||goto :eof for /f "delims=" %%a in ('dir /ad /b /s ^|findstr /rc:"\\[0-9]"') do ECHO rd /s /q "%%~a" popd pause Change the path behind the PUSHD command and run the code to show what w...
- 21 Oct 2010 16:33
- Forum: DOS Batch Forum
- Topic: Copy files from subfolders to one folder based on criteria
- Replies: 8
- Views: 8709
Re: Copy files from subfolders to one folder based on criter
Don't get it. You want to delete columns in excel files using batch?
Regards
aGerman
Regards
aGerman
- 21 Oct 2010 16:26
- Forum: DOS Batch Forum
- Topic: Transfer Files with Current Date
- Replies: 3
- Views: 4486
Re: Transfer Files with Current Date
Again, when dealing with dates, use vbscript or other programming languages that is able to handle dates well.. not batch Normaly I would agree with you, but in this case we have a good chance that you would find the same date format in %date% and in %%~ta. Now we could compare it directly, regardl...
- 21 Oct 2010 16:01
- Forum: DOS Batch Forum
- Topic: batch file issue for Dbf to csv
- Replies: 13
- Views: 13591
Re: batch file issue for Dbf to csv
Say if my data has 2 tabs, then I have to change the batch to 2 tabs in order for it to work. Why do you think you have to do that? Let say we have a TAB separated file (this is I first thought what a dbf file would be) like 123 TAB abc TAB 456 TAB xyz 234 TAB bcd TAB TAB uvw Then my batch file wou...
- 21 Oct 2010 15:17
- Forum: DOS Batch Forum
- Topic: Capture dynamic value as a variable
- Replies: 3
- Views: 4739
Re: Capture dynamic value as a variable
Try something like that: @echo off &setlocal enabledelayedexpansion for /f "delims=: tokens=1*" %%a in ('certutil -v -store My^|findstr /n .') do ( for /f %%c in ('echo\"%%b"^|findstr /i "_ID(20)"') do set /a n=%%a+1 for /f %%d in ('echo\%%a_^|findstr /x "!n!_&...
- 20 Oct 2010 12:07
- Forum: DOS Batch Forum
- Topic: batch file issue for Dbf to csv
- Replies: 13
- Views: 13591
Re: batch file issue for Dbf to csv
Seems we can't strike an agreement So the question again, can you specify in your batch the "\t" tab character, so that it knows its a tab its dealing with and the user of your batch don't have to change your batch file to make it work seamlessly. No, except I could upload my file here as ...
- 20 Oct 2010 11:27
- Forum: DOS Batch Forum
- Topic: Transfer Files with Current Date
- Replies: 3
- Views: 4486
Re: Transfer Files with Current Date
Hmm, not easy because it depends on the format settings for the date value. Maybe you could write a FTP file using batch that contains the zip files behind several PUT commands. Please try if the following batch file would return all todays zip files: @echo off &setlocal for %%a in (E:\FOLDER\SU...
- 19 Oct 2010 13:48
- Forum: DOS Batch Forum
- Topic: batch file issue for Dbf to csv
- Replies: 13
- Views: 13591
Re: batch file issue for Dbf to csv
OK, it seems like a .dbf file is not simply a file with tab separated values. In this case you will probably don't have luck with native batch. @ghost That's not what i meant. I mean that , because different people use different editors that may create variable number of spaces for tabs etc, that's ...
- 19 Oct 2010 13:17
- Forum: DOS Batch Forum
- Topic: Create folders named after each day in current month
- Replies: 5
- Views: 5332
Re: Create folders named after each day in current month
Generally this shouldn't be a problem because you can copy .xlt files directly to .xls files. It works similar to the code before, but you have to check if the files already exist to protect you from overwriting your data. @echo off &setlocal EnableDelayedExpansion Set mm=%DATE:~4,2% Set dd=%DAT...
- 18 Oct 2010 18:49
- Forum: DOS Batch Forum
- Topic: batch file issue for Dbf to csv
- Replies: 13
- Views: 13591
Re: batch file issue for Dbf to csv
but tabs are also dependent of how many spaces. can be 4, 8 etc. No ghost. A tab is a regular ASCII character (hex 09)! It has nothing to do with any environment settings. Of course some text editors (and also this forum software) change tab characters automaticaly to spaces. This depends on the se...
- 18 Oct 2010 18:33
- Forum: DOS Batch Forum
- Topic: Create folders named after each day in current month
- Replies: 5
- Views: 5332
Re: Create folders named after each day in current month
I adopted the formulas for :date2jdate and :jdate2date from there to create function :DaysPerMonth . It needs the year and the month as input and returns the number of days of the given month. Now we can use a FOR /L loop to create the directories. @echo off &setlocal Set mm=%DATE:~4,2% Set dd=%...
- 18 Oct 2010 11:49
- Forum: DOS Batch Forum
- Topic: error in tab/space with comma
- Replies: 4
- Views: 5407