Solved

Editing a batch file using double quotes

Posted on 2008-10-07
1
1,154 Views
Last Modified: 2012-05-05
I am currently creating a batch file in windows to schedule a task. The task I want to schedule is to run a VBS file which works if i create it in windows. When I run the batch file It adds in the scheduled task no problem but run box needs to have "runcommand" and the quotation marks arent there. this is because in the batch file it allready has them round this command but this is to get SCHTASKS.exe to work with a file. Basically what I need to know is, is there a way I can have double quotation marks in a batch file. Ive tried typing this but it just upsets the SCHTASKS.exe command and the batch file.
0
Comment
Question by:hmuser
1 Comment
 
LVL 31

Accepted Solution

by:
Paranormastic earned 125 total points
ID: 22661970
I'm not quite sure I'm reading your question right, so I will answer a couple of very different ways.

I believe you are asking if you can use the character " in a batch file - yes you can.  Careful to actually type it in instead of copying as sometimes copying from Word, etc. may give you curly quotes, aka smart quotes, instead of the standard straight quotation marks.  These curly quotes are non-standard characters and will give you a major headache.

Anytime you need quotes around something you could be able to do the entire command and then unquote, then quote again for the next necessary place.  Quotes twice in the same area should not be needed.  Also, sometimes you may need to do a whole file path in quotes, sometimes it may be better to not.
"%userprofile%" is one trick where when it converts this variable to the actual c:\docs and settings\username it will have spaces, which is bad, but by putting the variable in you get that in quotes so its happy again.  this can be done
"%userprofile%"\folder1\"folder two"  or "%userprofile%\folder1\folder two" - usually the latter works better if you need two in the same path.

If you need more help, it may be useful to post or upload the code example for more direct comment.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question