Jump to content

Recommended Posts

Posted

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?

Posted (edited)

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

$code=chr("148")

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

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")

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...