Collections:
Other Resources:
Remove Quotation Marks from Parameters
How to Remove Quotation Marks from Parameters?
✍: FYIcenter.com
If a parameter is passed in a quotation format,
you can remove quotation marks by using the
replacement function in the variable expansion expression
in 3 steps:
1. Assign the parameter to a variable. For example,
set x=%1
2. Update the variable with quotation marks removed:
set x=%x:"=% rem A more generic syntax is: %variable:old=new%
3. Use the variable anywhere you need it:
echo (%x%)
Here is a demonstration batch file called Parameter-Cleaned:
@echo off echo (%0) echo (%1) (%2) (%3) (%4) (%5) echo (%*) set x=%1 set x=%x:"=% echo (%x%)
You can test the above batch file like this:
C:\fyicenter>Parameter-Cleaned.bat "\Program Files (x86)\Java"
(Parameter-Cleaned.bat)
("\Program Files (x86)\Java") () () () ()
("\Program Files (x86)\Java")
(\Program Files (x86)\Java)
⇒ Multiple Quotations in a Single Parameter
⇐ Use Quotation to Protect Space in File Name
2021-11-12, ∼2859🔥, 0💬
Popular Posts:
What is "WWAN AutoConfig" in my Windows 7 service list? And how is "WWAN AutoConfig" service related...
What is tfswctrl.exe process - Sonic Drive Letter Access Component? Process tfswctrl.exe is the Driv...
What is Windows XP Services Management Console? Windows XP Services Management Console is a system a...
Can I disable Windows service "Broadcom ASF IP monitoring service v6.0.3" to speedup my computer? Wi...
What is "Microsoft Policy Platform Local Authority" in my Windows 7 service list? And how is "Micros...