Search found 4149 matches

by Squashman
18 Feb 2021 13:24
Forum: DOS Batch Forum
Topic: How to bring a special string into a variable?
Replies: 4
Views: 1617

Re: How to bring a special string into a variable?

If you want literal % symbols to be assigned to a variable in a batch file then you need to double them.

Code: Select all

set "a=%%BUFFER:*Word=%%"
At the command prompt just use the normal ^ to escape the %.
by Squashman
06 Feb 2021 23:40
Forum: DOS Batch Forum
Topic: Need a find and replace string for a file content
Replies: 3
Views: 1407

Re: Need a find and replace string for a file content

I would highly recommend you look at using JREPL
by Squashman
06 Feb 2021 23:36
Forum: DOS Batch Forum
Topic: Set a multiline variable
Replies: 13
Views: 2985

Re: Set a multiline variable

Both threads have been merged
by Squashman
05 Feb 2021 09:38
Forum: DOS Batch Forum
Topic: Exclude files if specific folder name
Replies: 5
Views: 1472

Re: Exclude files if specific folder name

You should probably change the rename to

Code: Select all

ren "%%~G" "%%~nG.bak"
The "n" modifier is the file name only. No path no extension.
by Squashman
05 Feb 2021 09:15
Forum: DOS Batch Forum
Topic: Exclude files if specific folder name
Replies: 5
Views: 1472

Re: Exclude files if specific folder name

I had the logic backwards. Remove the NOT.
by Squashman
05 Feb 2021 08:49
Forum: DOS Batch Forum
Topic: Exclude files if specific folder name
Replies: 5
Views: 1472

Re: Exclude files if specific folder name

Use string replacement to test if the folder exists within the folder path.

Code: Select all

for /R %%G in (*.dll) do (
     set "foldercheck=%%~dpG"
     IF  "!foldercheck:DoNotModify=!"=="!foldercheck!"  ren "%%~G" *.bak
)
by Squashman
03 Feb 2021 15:55
Forum: DOS Batch Forum
Topic: rename failure
Replies: 3
Views: 1319

Re: rename failure

Straight from the help file. Read the last line. H:\>rename /? Renames a file or files. RENAME [drive:][path]filename1 filename2. REN [drive:][path]filename1 filename2. Note that you cannot specify a new drive or path for your destination file. The syntax usage clearly shows that [PATH] is an option...
by Squashman
27 Jan 2021 14:37
Forum: DOS Batch Forum
Topic: How to get rid of the extra character ahead of the title
Replies: 11
Views: 2862

Re: How to get rid of the extra character ahead of the title

It has to be an affect of running an elevated cmd prompt.

In a normal cmd prompt if you do

Code: Select all

title=blah
The equals symbol does not end up in the Window Title.
by Squashman
22 Jan 2021 11:49
Forum: DOS Batch Forum
Topic: A script making it easy to set a variable with the output of a command
Replies: 3
Views: 1382

Re: A script making it easy to set a variable with the output of a command

The very first comment you make is about the nesting of commands to use as input to another command. This really doesn't solve that problem unless I am not understanding how to use your program to do that.
by Squashman
17 Jan 2021 23:04
Forum: DOS Batch Forum
Topic: HASHSUM.BAT v1.8 - emulate md5sum, shasum, and the like
Replies: 59
Views: 44617

Re: HASHSUM.BAT v1.6 - emulate md5sum, shasum, and the like

balubeto wrote:
17 Jan 2021 09:50
How do I incorporate the andresp code into the main script as well?

Thanks

Bye
I am going to take a wild guess and say download the code that andresp posted
by Squashman
16 Jan 2021 22:23
Forum: DOS Batch Forum
Topic: Windows 10 20H2 and hash file
Replies: 3
Views: 1263

Re: Windows 10 20H2 and hash file

Hi Using Windows 10 20H2, how can I create a script that, starting from a local or network directory, parses all its subdirectories creating a text file containing all the file names with the corresponding SHA1 hashes next to them? Thanks Bye Almost 10 years on these forums and you still pretty muc...
by Squashman
15 Jan 2021 18:37
Forum: DOS Batch Forum
Topic: save text file contents into a temporary variable and echo it only if that text file is modified
Replies: 2
Views: 1145

Re: save text file contents into a temporary variable and echo it only if that text file is modified

This question seems to have something to do with your previous question.

Are you just trying to TAIL a file?
by Squashman
14 Jan 2021 17:20
Forum: DOS Batch Forum
Topic: How to write REM Comments in a new file
Replies: 4
Views: 1449

Re: How to write REM Comments in a new file

To cut down on the amount of code you could do this. ( echo REM QBFC Project Options Begin echo REM HasVersionInfo: No echo REM Companyname: echo REM Productname: echo REM Filedescription: echo REM Copyrights: echo REM Trademarks: echo REM Originalname: echo REM Comments: echo REM Productversion: 1....
by Squashman
13 Jan 2021 12:43
Forum: DOS Batch Forum
Topic: login to website in script
Replies: 2
Views: 1145

Re: login to website in script

Matt Williamson wrote:
13 Jan 2021 07:52
Since search is broken,
I don't have an answer for your question but you do know you can use Google to search the site. Most of the time that is what I use because it is better at indexing the site then using the site search. Just append this to the end of your Google Search: site:dostips.com