Solved

Editing a batch file using double quotes

Posted on 2008-10-07
1
1,150 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now