• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 964
  • Last Modified:

Adding Inverted Commas in VBScript

Hi,

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.
0
Dhiraj Mutha
Asked:
Dhiraj Mutha
  • 2
1 Solution
 
lewismayCommented:
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
0
 
Dhiraj MuthaLevel DAuthor Commented:
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?
0
 
Dhiraj MuthaLevel DAuthor Commented:
It was ok. But did not resolved my issue.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now