Solved

Editing a batch file using double quotes

Posted on 2008-10-07
1
1,156 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

734 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