Search found 2429 matches
- 25 May 2020 08:03
- Forum: DOS Batch Forum
- Topic: How to rename filenames so only the first letter of words are capitalized?
- Replies: 4
- Views: 4679
Re: How to rename filenames so only the first letter of words are capitalized?
Assuming you are dealing with English, it is a simple 2 step process with JREN.BAT - a hybrid batch/JScript regular expression renaming utility. First capitalize the first character of every "word". Then convert all extensions to lower case. jren "([a-zA-Z])([a-zA-Z']*)" "uc($1)+lc($2)" /j jren "\.[...
- 23 May 2020 05:59
- Forum: DOS Batch Forum
- Topic: Self Updating Continuously Running Batch
- Replies: 7
- Views: 6557
Re: Self Updating Continuously Running Batch
It is hard to imagine a scenario where a self modifying batch file is the best option. It is almost always simpler have static code with various options built in, and use logic to execute the appropriate code. The only case I can think of where self modifying code might be handy is if the end user d...
- 22 May 2020 08:57
- Forum: DOS Batch Forum
- Topic: HASHSUM.BAT v1.8 - emulate md5sum, shasum, and the like
- Replies: 61
- Views: 94593
Re: HASHSUM.BAT v1.6 - emulate md5sum, shasum, and the like
For some reason I can't get it to execute properly. When I launch it, it seems to be calling cscript.exe but it hangs there. Any ideas what to do about this? That is the designed behavior - it is waiting for input on stdin. It will continue to wait (seemingly hang) until the stdin is closed. You co...
- 20 May 2020 08:55
- Forum: DOS Batch Forum
- Topic: JREN.BAT v2.8 - Rename files/folders using regular expressions
- Replies: 78
- Views: 177755
Re: JREN.BAT v2.8 - Rename files/folders using regular expressions
I'm' going to leave that coding exercise to you. The entire JScript language is at your disposal. You can include newlines in your output with the correct JScript code.
- 18 May 2020 07:30
- Forum: DOS Batch Forum
- Topic: JREN.BAT v2.8 - Rename files/folders using regular expressions
- Replies: 78
- Views: 177755
Re: JREN.BAT v2.8 - Rename files/folders using regular expressions
In general, the built in help (JREN /?) does a good job describing the features of JREN. It is up to you to figure out how to use those features. Plus there are examples throughout this thread. I hope you take the time to scan all the posts. What code would tell JREN.bat version 2.8 to: 1. count Fil...
- 15 May 2020 15:18
- Forum: DOS Batch Forum
- Topic: JREN.BAT v2.8 - Rename files/folders using regular expressions
- Replies: 78
- Views: 177755
Re: JREN.BAT v2.8 - Rename files/folders using regular expressions
The /FM must be the name of the folder or file you want, and the /P must be the full path leading up to that file/folder. for %%F in ("%~dp0.") do call jren "^" "size()+' '" /d /j /list /p "%%~dpF" /fm "%%~nxF" > "FolderList1.txt" "%~dp0." expands to "D:\portable\.", which is logically equivalent to...
- 14 May 2020 09:04
- Forum: DOS Batch Forum
- Topic: JREN.BAT v2.8 - Rename files/folders using regular expressions
- Replies: 78
- Views: 177755
Re: JREN.BAT v2.8 - Rename files/folders using regular expressions
Question 1 I'm not exactly sure what you are trying to do. If you want only the size of a single folder, like "D:\portable", then specify the root path with /P and specify the specific folder with /FM call jren "^" "size()+' '" /d /j /list /p "d:\" /fm "portable" Note that size() does not need an a...
- 08 May 2020 06:49
- Forum: DOS Batch Forum
- Topic: Read file1 and remove the lines in that file from file2
- Replies: 8
- Views: 6266
Re: Read file1 and remove the lines in that file from file2
No, /X and /V work fine together - it lists lines that do not exactly match any search string. It is easier to think in the negative sense - If a line exactly matches any of the search strings, then it is rejected.
- 08 May 2020 02:14
- Forum: DOS Batch Forum
- Topic: Read file1 and remove the lines in that file from file2
- Replies: 8
- Views: 6266
Re: Read file1 and remove the lines in that file from file2
Sure, just add the /X option. It is the same as using "^search$" in a regular expression, except it works with literal searches. The only potential problem is it only recognizes end of line before carriage returns. So each line must be terminated by \r\n (carriage return / linefeed). It won't recogn...
- 07 May 2020 08:20
- Forum: DOS Batch Forum
- Topic: Read file1 and remove the lines in that file from file2
- Replies: 8
- Views: 6266
Re: Read file1 and remove the lines in that file from file2
The solution is almost trivial with FINDSTR when using the /G option (ShadowThief missed the /L and /I options that are required to make the solution reliable) findstr /LIVG:"file1" "%windir%\System32\Drivers\Etc\Hosts" >"%windir%\System32\Drivers\Etc\Hosts.new" move /y "%windir%\System32\Drivers\Et...
- 03 May 2020 14:33
- Forum: DOS Batch Forum
- Topic: Shift and %*
- Replies: 5
- Views: 6487
Re: Shift and %*
You can have any number of spaces in any position within an argument as long as it is quoted. In fact, the only way to have spaces within a parameter is to use quotes - it is impossible to escape spaces (or any other token delimiters like , ; = <tab> <0xFF>) because the parameter parser ignores the ...
- 03 May 2020 10:04
- Forum: DOS Batch Forum
- Topic: HASHSUM.BAT v1.8 - emulate md5sum, shasum, and the like
- Replies: 61
- Views: 94593
Re: HASHSUM.BAT v1.6 - emulate md5sum, shasum, and the like
No, sorry Jean-François. I copied the wrong id. That last question was meant for andresp. I'll try again :oops: @andresp - I see why you changed to code page 65001, though I think the original code page should be saved before changing, and then restored at the end. But why did you substitute FINDSTR...
- 02 May 2020 15:16
- Forum: DOS Batch Forum
- Topic: HASHSUM.BAT v1.8 - emulate md5sum, shasum, and the like
- Replies: 61
- Views: 94593
Re: HASHSUM.BAT v1.6 - emulate md5sum, shasum, and the like
@jfl - I see why you changed to code page 65001, though I think the original code page should be saved before changing, and then restored at the end. But why did you substitute FINDSTR for FIND in two places? Is that really necessary? I'm thinking my original code used FIND for a reason, though I ca...
- 02 May 2020 09:07
- Forum: DOS Batch Forum
- Topic: HASHSUM.BAT v1.8 - emulate md5sum, shasum, and the like
- Replies: 61
- Views: 94593
Re: HASHSUM.BAT v1.6 - emulate md5sum, shasum, and the like
Thanks for the clarification. Yes, all internal command IO as well as any command line text is subject to transformation. But are you sure about the following: ...the standard input and arguments of myprog1.exe ARE converted by cmd to the console code page Arguments, absolutely, but surely an extern...
- 01 May 2020 23:22
- Forum: DOS Batch Forum
- Topic: HASHSUM.BAT v1.8 - emulate md5sum, shasum, and the like
- Replies: 61
- Views: 94593
Re: HASHSUM.BAT v1.6 - emulate md5sum, shasum, and the like
Any text that is piped from one application to another, or passed as an argument to a sub-command, is converted to the console code page for that. That simply is not true - pipes do not in and of themselves do any type of transformation. They can handle binary data just fine. Beyond that, the scrip...