Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know there are many posts on this issue but there is a minor twist to what I need to do.

I can figure out how to create a shortcut with an argument like this:
"C:\Program Files\My App\App.exe" /s

But I need to apply the path of a file wrapped in "" as argument like this:
"C:\Program Files\My App\App.exe" "c:\Data\File.ext"
Note the double quotes.

I can't find any VBscript examples illustrating this behaviour.
This is what I've based my current script on.

@echo off


echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT%
echo sLinkFile = "%USERPROFILE%\Desktop\myshortcut.lnk" >> %SCRIPT%
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT%
echo oLink.TargetPath = "D:\myfile.extension" >> %SCRIPT%
echo oLink.Save >> %SCRIPT%

cscript /nologo %SCRIPT%
del %SCRIPT%
share|improve this question
What code/method are you currently using to create your shortcut? BTW: VBScript != Batch File – Ƭᴇcʜιᴇ007 Sep 26 '13 at 16:37
@techie007 - I am aware. I am calling a temporary VBScript from within the batch file. Something like this – Morten Kahr Sep 26 '13 at 17:30
Here check this discussion… – vembutech Feb 23 '15 at 14:58

The soultion was the triple quotes:

For some reason the

echo oLink.arguments = Chr(34) & "c:\Data\File 1.ext" & Chr(34)

Makes the File 1.ext open.

share|improve this answer

Try adding

echo oLink.arguments = "c:\Data\File.ext"

Before the

If you find you still need to include the quotes (I don't think you would), you can triple them up in the batch file.

echo oLink.arguments = """c:\Data\File 1.ext"""

The outer-most quotes are the ones delimiting the string, and the inner doubled up double quotes are to put the double quote within the string.

share|improve this answer
I need the quotes as the App.exe splits the argument if it contains spaces. I.e. C:\Data\File 1.ext – Morten Kahr Sep 26 '13 at 18:20
@MortenKahr Usually I use Chr(34) instead of double quotes for the outer pair as shown on stackoverflow – nixda Sep 26 '13 at 18:31
@nixda So echo oLink.arguments = Chr(34) c:\Data\File 1.ext Chr(34) ? – Morten Kahr Sep 26 '13 at 18:39
@MortenKahr echo oLink.arguments = Chr(34) & "c:\Data\File 1.ext" & Chr(34) – nixda Sep 26 '13 at 18:44
Adjusted my answer (after testing). – Ƭᴇcʜιᴇ007 Sep 26 '13 at 18:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.