Computing.Net > Forums > Disk Operating System > removing quotes from batch variable

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

removing quotes from batch variable

Reply to Message Icon

Name: fillae
Date: January 30, 2003 at 11:03:54 Pacific
OS: win2k server
CPU/Ram: dual 600 / 1gig
Comment:

Ok, I've been wrestling with this for some time now. I have a text file that has a directory path on each line. Each path entry in the file is double-quoted to handle long file names. Is there a way to remove the quotes either by:

1) putting the path in a variable without the quotes?

2) putting the path in another text file without the quotes?

3) putting short paths into the file to begin with so the double quotes are not needed?

Any help would be appreciated!



Sponsored Link
Ads by Google

Response Number 1
Name: dtech10
Date: January 30, 2003 at 14:15:01 Pacific
Reply:

Hi fillae
I have an old dos program that I got from "PC Magazine" I think it lets you change text files. In your case you would type Change.exe Filename 34 "" you can use text within quotes and the askii codes.
It works ok on my system WinXP Pro.
Hope this helps


0

Response Number 2
Name: Secret_Doom
Date: January 30, 2003 at 20:15:25 Pacific
Reply:

You can use the FOR cmd to process the filename, passing each line to a certain variable (like %%A), removing surrounding quotes:

for /F "delims=" %%A in (FILENAME.EXT) do echo PATH=%%~A

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br

_______________________________________________________


0

Response Number 3
Name: fillae
Date: January 31, 2003 at 11:43:30 Pacific
Reply:

Thanks for the responses.

I was actually able to work through this one with some experimenting. My solution was:

dir %2 /s /b > NewPath.txt
for /f "delims=" %%a in (NewPath.txt) do set DirPath=%%a
del NewPath.txt

The %2 variable was double-quoted, but by putting it into a text file, then doing a for loop to put it in another variable, it removed the quotes. Not sure if this is a great method or not, but it is working.

Thanks!


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: removing quotes from batch variable

How to run add/remove program from MS-DOS? www.computing.net/answers/dos/how-to-run-addremove-program-from-msdos/5074.html

Edit registry from batch www.computing.net/answers/dos/edit-registry-from-batch/11420.html

reading Ini file variables from Batch/Dos Prompt www.computing.net/answers/dos/reading-ini-file-variables-from-batchdos-prompt/4422.html