Sign in to follow this  
Followers 0
LAMSAG

Embedding the " in a string

4 posts in this topic

I am creating a shortcut to cmd.exe as follows:

FileCreateShortcut(@SystemDir&"\cmd.exe", "My Link.lnk", $installDir, "/e:on /f:on /K "&$installDir&"\envVars.bat && cls", "Command Shell", $installDir&"\bin\myExe.exe")

The problem is that the link is invalid, because in order to concatenate two commands when using the option /K in cmd .exe the string requires to be within " characters. How can I embed the " character within the string?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Did you try sending the " as an ascii char ? like this

$code=chr("148")

msgbox(0,"",$code & "Hello" & $code )
Edited by win2k

Share this post


Link to post
Share on other sites

Create a new variable:

$cmdString = "/e:on /f:on /K "&Chr(34)&$installDir&"\envVars.bat && cls"&Chr(34)

Then

FileCreateShortcut(@SystemDir&"\cmd.exe", "My Link.lnk", $installDir, $cmdString, "Command Shell", $installDir&"\bin\myExe.exe")

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0