How to Stip out characters passed to batch

  • Thread starter Thread starter Cliff
  • Start date Start date
C

Cliff

I passed a series of words to a batch surrounded by quotes

call test "This is one parameter"

In the batchfile test I'd like to stip out the quote characters. Is this
possible somehow? Thanks in advance.
 
Cliff said:
In the batchfile test I'd like to stip out the quote characters. Is this
possible somehow? Thanks in advance.

Yes, something like:-

@echo off & setlocal ENABLEEXTENSIONS
set var=%~1
echo/%var%

From the CALL help page:-

%~1 - expands %1 removing any surrounding quotes (")
 
Cliff said:
I passed a series of words to a batch surrounded by quotes

call test "This is one parameter"

In the batchfile test I'd like to stip out the quote characters. Is this
possible somehow? Thanks in advance.

Thanks to all....jeez it's easy once you know how!
 
You need to be careful with this one. This was the only way to do this
before %~1, but it's not quite the same since it also deletes embedded
quotes.

-Tim
 
In the batchfile test I'd like to stip out the quote characters. Is this
possible somehow? Thanks in advance.

The $DEQUOT Function of the FREE Advanced NT/2K/XP Command Library will do
this CONSISTENTLY under all NT-based operating systems.

For a literal string:

ntlib $DEQUOT "Your Text String Here"

{results returned in variable %_DEQUOT%}

or to DEQUOT the -CONTENTS- of a variable

ntlib $DEQUOT VariableName

(results returned in %VariableName%}

*******

See (http://TheSystemGuard.com/NTCmdLib/Functions/DEQUOT.htm) for a
color-keyed example.

*******

ntlib.cmd provides dozens of resources to standardize shell scripting syntax
across Windows NT/2K/XP/K3 while using only what is available in a standard
install of each platform. You can obtain it (for FREE) at
(http://ntlib.com).

*******

-tsg
____________________________________________________________
TheSystemGuard.com | BoomingOrFuming.com | MountCommands.com
Free and "Almost Free" Knowledge for Windows System Admins!
 
Back
Top