Adding Inverted Commas in VBScript

Posted on 2008-11-14
Last Modified: 2012-05-05

I use VBScript to add the below line to HKLM\Sofware\Microsoft\Windows\CurrentVersion\Run.

wscript.exe C:\Documents and Settings\Administrator\Desktop\Domain12.vbs

It adds the line to registry but I want it to be added in the below format (With Inverted Comma's)

wscript.exe "C:\Documents and Settings\Administrator\Desktop\Domain12.vbs"

I use the following command:
strCommand = "cmd /c REG ADD HKLM\Software\Microsoft\Windows\CurrentVersion\Run /v ""VBS Join Domain"" /d ""wscript.exe C:\Documents and Settings\Administrator\Desktop\Domain12.vbs /f"

What are the changes i have to make in the above command. Please help.
Question by:Dhiraj Mutha
    LVL 1

    Accepted Solution

    If I understand your question correctly something like this might work

    strCommand = "cmd /c REG ADD HKLM\Software\Microsoft\Windows\CurrentVersion\Run /v ""VBS Join Domain"" /d ""wscript.exe " & chr(34) & "C:\Documents and Settings\Administrator\Desktop\Domain12.vbs" & chr(34) & " /f"

    Good luck
    LVL 14

    Author Comment

    by:Dhiraj Mutha
    If i use this comamnd to output on a msgbox it shows fine. But in registry it add like this:

    This is what i see in registry:
    wscript.exe  chr(34)C:\Documents and Settings\Administrator\Desktop\Domain12.vbschr(34)  /f

    Can you help on this?
    LVL 14

    Author Closing Comment

    by:Dhiraj Mutha
    It was ok. But did not resolved my issue.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    cPanel is a Unix based web hosting control panel that provides a graphical interface and automation tools designed to simplify the process of hosting a web site. cPanel utilizes a 3 tier structure that provides functionality for administrators, rese…
    Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    758 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

    13 Experts available now in Live!

    Get 1:1 Help Now