Solved

Editing a batch file using double quotes

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

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

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…
If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

623 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