user3692168
user3692168

Reputation: 13

How Can I pass two paths with spaces as arguments for a bat file?

I have a bat file like:

replace.exe Path1 Path2

Where Path1 and Path2 are folders paths with spaces like C:\Folder 1\ and C:\Folder 2\ So, the bat file look like:

replace.exe C:\Folder 1\ C:\Folder 2\

of course, because of the space in the both paths the argument are passes improperly.

How can I do this?

Update:

I try replace.exe %1 %2 in the bat file and pass the arguments in the cmd like:

Call replace.exe "C:\Folder 1\" "C:\Folder 2\"

this actually work. But I want to write the paths in bat file, not in the cmd windows.

Upvotes: 0

Views: 658

Answers (2)

mifi79
mifi79

Reputation: 1106

Does

@echo off
set replace="C:\Folder 1\"
set with="C:\Folder 2\"
replace.exe %replace% %with%

work?

Upvotes: 1

kebs
kebs

Reputation: 6707

This should work: ;-)

replace.exe "C:\Folder 1\" "C:\Folder 2\"

Upvotes: 1

Related Questions