How to Stip out characters passed to batch

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.
 
R

Ritchie

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 (")
 
C

Cliff

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!
 
T

Tim Hill

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
 
G

guard

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top