Categories:
Administration (161)
Adware Spyware (43)
Apache (20)
Bluetooth (127)
DOS Commands (2)
Edge (28)
General (5)
Internet Connection (21)
Internet Explorer (224)
Media Center (14)
Media Player (135)
Mozilla Firefox (22)
MS Access (9)
Performance (204)
PHP (25)
Programming (36)
Security (109)
Silverlight (22)
Tips (144)
Tools (312)
Tutorials (40)
Windows 10 (168)
Windows 7 (1411)
Windows 8 (1712)
Windows Phone (33)
Windows Server 2008 (165)
Windows Server 2012 (84)
Windows Server 2016 (23)
Windows Vista (71)
Windows XP (23)
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
2017-12-05, 702👍, 0💬
Popular Posts:
Where to find tutorials on using Windows 7 Security? Here is a collection of tutorials on Windows 7 ...
What is the "Smart Card Device Enumeration Service (ScDeviceEnum)" system service on Windows Server ...
What are required to use wireless routers to connect to the Internet? If you want to connect to the ...
Can I disable Windows service "WLANKEEPER" to speedup my computer? Windows service "WLANKEEPER" - Pr...
Where to find tutorials on using Windows 10? I want to learn how to use Windows 10 more efficiently....