How to escape equal = sign in VBS Shell command parameter
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
Using VBS on Windows 2012 R2 I am trying to pass a command line parameter isActive="false"
but I cannot get the equal sign to appear in the command line.
Create a dummy batch file like test.bat
echo %1
Pause
Then in the created VBScript
Set oShell = WScript.CreateObject("WSCript.Shell")
oShell.CurrentDirectory = "C:test"
'strEqual = Chr(61)
strCommand = "test.bat" & " " & "isActive=" &"""false"""
return = oShell.Run(strCommand, 1, True)
Set oShell = Nothing
I get isActive "false" but no equal sign.
I have tried separating out as a unique value
like & Chr(61) &
and have tried escaping with /
and and
//
and \
before and after the equal sign. I have tried to use as a variable, strEqual = Chr(61)
.
I am at a loss as to how to get the =
to be part of the string when passed to the command shell. I can write it to a text file and the equal sign is written, but not in the shell.
batch-file vbscript escaping wsh
|
show 1 more comment
Using VBS on Windows 2012 R2 I am trying to pass a command line parameter isActive="false"
but I cannot get the equal sign to appear in the command line.
Create a dummy batch file like test.bat
echo %1
Pause
Then in the created VBScript
Set oShell = WScript.CreateObject("WSCript.Shell")
oShell.CurrentDirectory = "C:test"
'strEqual = Chr(61)
strCommand = "test.bat" & " " & "isActive=" &"""false"""
return = oShell.Run(strCommand, 1, True)
Set oShell = Nothing
I get isActive "false" but no equal sign.
I have tried separating out as a unique value
like & Chr(61) &
and have tried escaping with /
and and
//
and \
before and after the equal sign. I have tried to use as a variable, strEqual = Chr(61)
.
I am at a loss as to how to get the =
to be part of the string when passed to the command shell. I can write it to a text file and the equal sign is written, but not in the shell.
batch-file vbscript escaping wsh
Why are you trying to do that?, if you want to just pass arguments to the batch that isn't the way to do it. As a quick test, try running that command inside a Windows Command Prompt (test.bat isActive="false"
) yourself to see if it's doable before you add a VBScript into the mix.
– Lankymart
Nov 15 '18 at 8:25
2
UsestrCommand = "test.bat ""isActive=""false"""""
in VBScript and modify youttest.bat
asecho %~1
.
– JosefZ
Nov 15 '18 at 10:06
test.bat isActive="false" is proper for what I need. The actual batch file is a differnt batch file but it requires the parameter as isActive="false"
– Hammertime
Nov 15 '18 at 11:24
My command string is strCommand="dssetprop User-21 ""isActive=""false""""" and it returns dssetprop User-21 "isActive="false"" and fails becuase of the quotes around the string
– Hammertime
Nov 15 '18 at 12:28
Because you have stated that the CMD uses = as a delimiter is the reason I need to escape it so it ignores it as a delimiter and treats it as a character
– Hammertime
Nov 15 '18 at 12:31
|
show 1 more comment
Using VBS on Windows 2012 R2 I am trying to pass a command line parameter isActive="false"
but I cannot get the equal sign to appear in the command line.
Create a dummy batch file like test.bat
echo %1
Pause
Then in the created VBScript
Set oShell = WScript.CreateObject("WSCript.Shell")
oShell.CurrentDirectory = "C:test"
'strEqual = Chr(61)
strCommand = "test.bat" & " " & "isActive=" &"""false"""
return = oShell.Run(strCommand, 1, True)
Set oShell = Nothing
I get isActive "false" but no equal sign.
I have tried separating out as a unique value
like & Chr(61) &
and have tried escaping with /
and and
//
and \
before and after the equal sign. I have tried to use as a variable, strEqual = Chr(61)
.
I am at a loss as to how to get the =
to be part of the string when passed to the command shell. I can write it to a text file and the equal sign is written, but not in the shell.
batch-file vbscript escaping wsh
Using VBS on Windows 2012 R2 I am trying to pass a command line parameter isActive="false"
but I cannot get the equal sign to appear in the command line.
Create a dummy batch file like test.bat
echo %1
Pause
Then in the created VBScript
Set oShell = WScript.CreateObject("WSCript.Shell")
oShell.CurrentDirectory = "C:test"
'strEqual = Chr(61)
strCommand = "test.bat" & " " & "isActive=" &"""false"""
return = oShell.Run(strCommand, 1, True)
Set oShell = Nothing
I get isActive "false" but no equal sign.
I have tried separating out as a unique value
like & Chr(61) &
and have tried escaping with /
and and
//
and \
before and after the equal sign. I have tried to use as a variable, strEqual = Chr(61)
.
I am at a loss as to how to get the =
to be part of the string when passed to the command shell. I can write it to a text file and the equal sign is written, but not in the shell.
batch-file vbscript escaping wsh
batch-file vbscript escaping wsh
edited Nov 15 '18 at 9:21
Ansgar Wiechers
146k13134192
146k13134192
asked Nov 15 '18 at 7:57
HammertimeHammertime
246
246
Why are you trying to do that?, if you want to just pass arguments to the batch that isn't the way to do it. As a quick test, try running that command inside a Windows Command Prompt (test.bat isActive="false"
) yourself to see if it's doable before you add a VBScript into the mix.
– Lankymart
Nov 15 '18 at 8:25
2
UsestrCommand = "test.bat ""isActive=""false"""""
in VBScript and modify youttest.bat
asecho %~1
.
– JosefZ
Nov 15 '18 at 10:06
test.bat isActive="false" is proper for what I need. The actual batch file is a differnt batch file but it requires the parameter as isActive="false"
– Hammertime
Nov 15 '18 at 11:24
My command string is strCommand="dssetprop User-21 ""isActive=""false""""" and it returns dssetprop User-21 "isActive="false"" and fails becuase of the quotes around the string
– Hammertime
Nov 15 '18 at 12:28
Because you have stated that the CMD uses = as a delimiter is the reason I need to escape it so it ignores it as a delimiter and treats it as a character
– Hammertime
Nov 15 '18 at 12:31
|
show 1 more comment
Why are you trying to do that?, if you want to just pass arguments to the batch that isn't the way to do it. As a quick test, try running that command inside a Windows Command Prompt (test.bat isActive="false"
) yourself to see if it's doable before you add a VBScript into the mix.
– Lankymart
Nov 15 '18 at 8:25
2
UsestrCommand = "test.bat ""isActive=""false"""""
in VBScript and modify youttest.bat
asecho %~1
.
– JosefZ
Nov 15 '18 at 10:06
test.bat isActive="false" is proper for what I need. The actual batch file is a differnt batch file but it requires the parameter as isActive="false"
– Hammertime
Nov 15 '18 at 11:24
My command string is strCommand="dssetprop User-21 ""isActive=""false""""" and it returns dssetprop User-21 "isActive="false"" and fails becuase of the quotes around the string
– Hammertime
Nov 15 '18 at 12:28
Because you have stated that the CMD uses = as a delimiter is the reason I need to escape it so it ignores it as a delimiter and treats it as a character
– Hammertime
Nov 15 '18 at 12:31
Why are you trying to do that?, if you want to just pass arguments to the batch that isn't the way to do it. As a quick test, try running that command inside a Windows Command Prompt (
test.bat isActive="false"
) yourself to see if it's doable before you add a VBScript into the mix.– Lankymart
Nov 15 '18 at 8:25
Why are you trying to do that?, if you want to just pass arguments to the batch that isn't the way to do it. As a quick test, try running that command inside a Windows Command Prompt (
test.bat isActive="false"
) yourself to see if it's doable before you add a VBScript into the mix.– Lankymart
Nov 15 '18 at 8:25
2
2
Use
strCommand = "test.bat ""isActive=""false"""""
in VBScript and modify yout test.bat
as echo %~1
.– JosefZ
Nov 15 '18 at 10:06
Use
strCommand = "test.bat ""isActive=""false"""""
in VBScript and modify yout test.bat
as echo %~1
.– JosefZ
Nov 15 '18 at 10:06
test.bat isActive="false" is proper for what I need. The actual batch file is a differnt batch file but it requires the parameter as isActive="false"
– Hammertime
Nov 15 '18 at 11:24
test.bat isActive="false" is proper for what I need. The actual batch file is a differnt batch file but it requires the parameter as isActive="false"
– Hammertime
Nov 15 '18 at 11:24
My command string is strCommand="dssetprop User-21 ""isActive=""false""""" and it returns dssetprop User-21 "isActive="false"" and fails becuase of the quotes around the string
– Hammertime
Nov 15 '18 at 12:28
My command string is strCommand="dssetprop User-21 ""isActive=""false""""" and it returns dssetprop User-21 "isActive="false"" and fails becuase of the quotes around the string
– Hammertime
Nov 15 '18 at 12:28
Because you have stated that the CMD uses = as a delimiter is the reason I need to escape it so it ignores it as a delimiter and treats it as a character
– Hammertime
Nov 15 '18 at 12:31
Because you have stated that the CMD uses = as a delimiter is the reason I need to escape it so it ignores it as a delimiter and treats it as a character
– Hammertime
Nov 15 '18 at 12:31
|
show 1 more comment
2 Answers
2
active
oldest
votes
You observe this behavior because CMD uses not only spaces and tabs, but also commas, semicolons, and the =
character as parameter delimiters. Meaning that isActive="false"
is parsed as 2 distinct arguments: isActive
and "false"
. If you want it to be parsed as a single argument you need to put the whole key/value pair in quotes: "isActive=false"
.
Note that the double quotes inside VBScript string literals must be escaped by doubling them. If you require double quotes around the value part of the argument simply add another set of escaped double quotes.
Set oShell = CreateObject("WScript.Shell")
strCommand = "test.bat ""isActive=""false"""""
return = oShell.Run(strCommand, 1, True)
There is also no need to concatenate string literals (except for readability reasons when you want to wrap a long string). Just define your command as a single string.
It will fail if I manually enter test.bat "isActive="false"" in the command window. I require it to read isActive="false" .
– Hammertime
Nov 15 '18 at 11:27
The final statement will be test.bat User-21 isActive="false" I get teh user from an Array. I have no problems in getting the command of test.bat User-21 But the best I have been able to get is test.bat User-21 isActive "false" the equal sign keeps getting dropped and is required.
– Hammertime
Nov 15 '18 at 11:46
1
@Hammertime If you require the nested double quotes around the value part of the argument you just need to add another set of escaped double quotes around that value.
– Ansgar Wiechers
Nov 15 '18 at 12:35
3
@Hammertime, In your bat file, useecho %~1
instead ofecho %1
, which the former with~
will remove the outer double quotes.
– michael_heath
Nov 15 '18 at 13:41
1
Ok, resolved by using VBS to send command with outer quotes to a batch file which echos the proper command to execute with %~1 removing the outer quotes and keeping the = sign
– Hammertime
Nov 15 '18 at 22:49
|
show 13 more comments
You may pass a value from VBS to BAT/CMD using process environment variable.
Save the below code as test.vbs:
strCurDir = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName) & ""
CreateObject("WScript.Shell").Environment("process").Item("myvar") = "isActive=""false"""
CreateObject("WSCript.Shell").Run strCurDir & "test.bat"
And this code save as test.bat in the same folder:
echo %myvar%
pause
Run test.vbs and console output will be
C:Windowssystem32>echo isActive="false"
isActive="false"
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314744%2fhow-to-escape-equal-sign-in-vbs-shell-command-parameter%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You observe this behavior because CMD uses not only spaces and tabs, but also commas, semicolons, and the =
character as parameter delimiters. Meaning that isActive="false"
is parsed as 2 distinct arguments: isActive
and "false"
. If you want it to be parsed as a single argument you need to put the whole key/value pair in quotes: "isActive=false"
.
Note that the double quotes inside VBScript string literals must be escaped by doubling them. If you require double quotes around the value part of the argument simply add another set of escaped double quotes.
Set oShell = CreateObject("WScript.Shell")
strCommand = "test.bat ""isActive=""false"""""
return = oShell.Run(strCommand, 1, True)
There is also no need to concatenate string literals (except for readability reasons when you want to wrap a long string). Just define your command as a single string.
It will fail if I manually enter test.bat "isActive="false"" in the command window. I require it to read isActive="false" .
– Hammertime
Nov 15 '18 at 11:27
The final statement will be test.bat User-21 isActive="false" I get teh user from an Array. I have no problems in getting the command of test.bat User-21 But the best I have been able to get is test.bat User-21 isActive "false" the equal sign keeps getting dropped and is required.
– Hammertime
Nov 15 '18 at 11:46
1
@Hammertime If you require the nested double quotes around the value part of the argument you just need to add another set of escaped double quotes around that value.
– Ansgar Wiechers
Nov 15 '18 at 12:35
3
@Hammertime, In your bat file, useecho %~1
instead ofecho %1
, which the former with~
will remove the outer double quotes.
– michael_heath
Nov 15 '18 at 13:41
1
Ok, resolved by using VBS to send command with outer quotes to a batch file which echos the proper command to execute with %~1 removing the outer quotes and keeping the = sign
– Hammertime
Nov 15 '18 at 22:49
|
show 13 more comments
You observe this behavior because CMD uses not only spaces and tabs, but also commas, semicolons, and the =
character as parameter delimiters. Meaning that isActive="false"
is parsed as 2 distinct arguments: isActive
and "false"
. If you want it to be parsed as a single argument you need to put the whole key/value pair in quotes: "isActive=false"
.
Note that the double quotes inside VBScript string literals must be escaped by doubling them. If you require double quotes around the value part of the argument simply add another set of escaped double quotes.
Set oShell = CreateObject("WScript.Shell")
strCommand = "test.bat ""isActive=""false"""""
return = oShell.Run(strCommand, 1, True)
There is also no need to concatenate string literals (except for readability reasons when you want to wrap a long string). Just define your command as a single string.
It will fail if I manually enter test.bat "isActive="false"" in the command window. I require it to read isActive="false" .
– Hammertime
Nov 15 '18 at 11:27
The final statement will be test.bat User-21 isActive="false" I get teh user from an Array. I have no problems in getting the command of test.bat User-21 But the best I have been able to get is test.bat User-21 isActive "false" the equal sign keeps getting dropped and is required.
– Hammertime
Nov 15 '18 at 11:46
1
@Hammertime If you require the nested double quotes around the value part of the argument you just need to add another set of escaped double quotes around that value.
– Ansgar Wiechers
Nov 15 '18 at 12:35
3
@Hammertime, In your bat file, useecho %~1
instead ofecho %1
, which the former with~
will remove the outer double quotes.
– michael_heath
Nov 15 '18 at 13:41
1
Ok, resolved by using VBS to send command with outer quotes to a batch file which echos the proper command to execute with %~1 removing the outer quotes and keeping the = sign
– Hammertime
Nov 15 '18 at 22:49
|
show 13 more comments
You observe this behavior because CMD uses not only spaces and tabs, but also commas, semicolons, and the =
character as parameter delimiters. Meaning that isActive="false"
is parsed as 2 distinct arguments: isActive
and "false"
. If you want it to be parsed as a single argument you need to put the whole key/value pair in quotes: "isActive=false"
.
Note that the double quotes inside VBScript string literals must be escaped by doubling them. If you require double quotes around the value part of the argument simply add another set of escaped double quotes.
Set oShell = CreateObject("WScript.Shell")
strCommand = "test.bat ""isActive=""false"""""
return = oShell.Run(strCommand, 1, True)
There is also no need to concatenate string literals (except for readability reasons when you want to wrap a long string). Just define your command as a single string.
You observe this behavior because CMD uses not only spaces and tabs, but also commas, semicolons, and the =
character as parameter delimiters. Meaning that isActive="false"
is parsed as 2 distinct arguments: isActive
and "false"
. If you want it to be parsed as a single argument you need to put the whole key/value pair in quotes: "isActive=false"
.
Note that the double quotes inside VBScript string literals must be escaped by doubling them. If you require double quotes around the value part of the argument simply add another set of escaped double quotes.
Set oShell = CreateObject("WScript.Shell")
strCommand = "test.bat ""isActive=""false"""""
return = oShell.Run(strCommand, 1, True)
There is also no need to concatenate string literals (except for readability reasons when you want to wrap a long string). Just define your command as a single string.
edited Nov 15 '18 at 12:39
answered Nov 15 '18 at 9:18
Ansgar WiechersAnsgar Wiechers
146k13134192
146k13134192
It will fail if I manually enter test.bat "isActive="false"" in the command window. I require it to read isActive="false" .
– Hammertime
Nov 15 '18 at 11:27
The final statement will be test.bat User-21 isActive="false" I get teh user from an Array. I have no problems in getting the command of test.bat User-21 But the best I have been able to get is test.bat User-21 isActive "false" the equal sign keeps getting dropped and is required.
– Hammertime
Nov 15 '18 at 11:46
1
@Hammertime If you require the nested double quotes around the value part of the argument you just need to add another set of escaped double quotes around that value.
– Ansgar Wiechers
Nov 15 '18 at 12:35
3
@Hammertime, In your bat file, useecho %~1
instead ofecho %1
, which the former with~
will remove the outer double quotes.
– michael_heath
Nov 15 '18 at 13:41
1
Ok, resolved by using VBS to send command with outer quotes to a batch file which echos the proper command to execute with %~1 removing the outer quotes and keeping the = sign
– Hammertime
Nov 15 '18 at 22:49
|
show 13 more comments
It will fail if I manually enter test.bat "isActive="false"" in the command window. I require it to read isActive="false" .
– Hammertime
Nov 15 '18 at 11:27
The final statement will be test.bat User-21 isActive="false" I get teh user from an Array. I have no problems in getting the command of test.bat User-21 But the best I have been able to get is test.bat User-21 isActive "false" the equal sign keeps getting dropped and is required.
– Hammertime
Nov 15 '18 at 11:46
1
@Hammertime If you require the nested double quotes around the value part of the argument you just need to add another set of escaped double quotes around that value.
– Ansgar Wiechers
Nov 15 '18 at 12:35
3
@Hammertime, In your bat file, useecho %~1
instead ofecho %1
, which the former with~
will remove the outer double quotes.
– michael_heath
Nov 15 '18 at 13:41
1
Ok, resolved by using VBS to send command with outer quotes to a batch file which echos the proper command to execute with %~1 removing the outer quotes and keeping the = sign
– Hammertime
Nov 15 '18 at 22:49
It will fail if I manually enter test.bat "isActive="false"" in the command window. I require it to read isActive="false" .
– Hammertime
Nov 15 '18 at 11:27
It will fail if I manually enter test.bat "isActive="false"" in the command window. I require it to read isActive="false" .
– Hammertime
Nov 15 '18 at 11:27
The final statement will be test.bat User-21 isActive="false" I get teh user from an Array. I have no problems in getting the command of test.bat User-21 But the best I have been able to get is test.bat User-21 isActive "false" the equal sign keeps getting dropped and is required.
– Hammertime
Nov 15 '18 at 11:46
The final statement will be test.bat User-21 isActive="false" I get teh user from an Array. I have no problems in getting the command of test.bat User-21 But the best I have been able to get is test.bat User-21 isActive "false" the equal sign keeps getting dropped and is required.
– Hammertime
Nov 15 '18 at 11:46
1
1
@Hammertime If you require the nested double quotes around the value part of the argument you just need to add another set of escaped double quotes around that value.
– Ansgar Wiechers
Nov 15 '18 at 12:35
@Hammertime If you require the nested double quotes around the value part of the argument you just need to add another set of escaped double quotes around that value.
– Ansgar Wiechers
Nov 15 '18 at 12:35
3
3
@Hammertime, In your bat file, use
echo %~1
instead of echo %1
, which the former with ~
will remove the outer double quotes.– michael_heath
Nov 15 '18 at 13:41
@Hammertime, In your bat file, use
echo %~1
instead of echo %1
, which the former with ~
will remove the outer double quotes.– michael_heath
Nov 15 '18 at 13:41
1
1
Ok, resolved by using VBS to send command with outer quotes to a batch file which echos the proper command to execute with %~1 removing the outer quotes and keeping the = sign
– Hammertime
Nov 15 '18 at 22:49
Ok, resolved by using VBS to send command with outer quotes to a batch file which echos the proper command to execute with %~1 removing the outer quotes and keeping the = sign
– Hammertime
Nov 15 '18 at 22:49
|
show 13 more comments
You may pass a value from VBS to BAT/CMD using process environment variable.
Save the below code as test.vbs:
strCurDir = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName) & ""
CreateObject("WScript.Shell").Environment("process").Item("myvar") = "isActive=""false"""
CreateObject("WSCript.Shell").Run strCurDir & "test.bat"
And this code save as test.bat in the same folder:
echo %myvar%
pause
Run test.vbs and console output will be
C:Windowssystem32>echo isActive="false"
isActive="false"
add a comment |
You may pass a value from VBS to BAT/CMD using process environment variable.
Save the below code as test.vbs:
strCurDir = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName) & ""
CreateObject("WScript.Shell").Environment("process").Item("myvar") = "isActive=""false"""
CreateObject("WSCript.Shell").Run strCurDir & "test.bat"
And this code save as test.bat in the same folder:
echo %myvar%
pause
Run test.vbs and console output will be
C:Windowssystem32>echo isActive="false"
isActive="false"
add a comment |
You may pass a value from VBS to BAT/CMD using process environment variable.
Save the below code as test.vbs:
strCurDir = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName) & ""
CreateObject("WScript.Shell").Environment("process").Item("myvar") = "isActive=""false"""
CreateObject("WSCript.Shell").Run strCurDir & "test.bat"
And this code save as test.bat in the same folder:
echo %myvar%
pause
Run test.vbs and console output will be
C:Windowssystem32>echo isActive="false"
isActive="false"
You may pass a value from VBS to BAT/CMD using process environment variable.
Save the below code as test.vbs:
strCurDir = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName) & ""
CreateObject("WScript.Shell").Environment("process").Item("myvar") = "isActive=""false"""
CreateObject("WSCript.Shell").Run strCurDir & "test.bat"
And this code save as test.bat in the same folder:
echo %myvar%
pause
Run test.vbs and console output will be
C:Windowssystem32>echo isActive="false"
isActive="false"
answered Nov 16 '18 at 0:11
omegastripesomegastripes
8,75922159
8,75922159
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314744%2fhow-to-escape-equal-sign-in-vbs-shell-command-parameter%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Why are you trying to do that?, if you want to just pass arguments to the batch that isn't the way to do it. As a quick test, try running that command inside a Windows Command Prompt (
test.bat isActive="false"
) yourself to see if it's doable before you add a VBScript into the mix.– Lankymart
Nov 15 '18 at 8:25
2
Use
strCommand = "test.bat ""isActive=""false"""""
in VBScript and modify youttest.bat
asecho %~1
.– JosefZ
Nov 15 '18 at 10:06
test.bat isActive="false" is proper for what I need. The actual batch file is a differnt batch file but it requires the parameter as isActive="false"
– Hammertime
Nov 15 '18 at 11:24
My command string is strCommand="dssetprop User-21 ""isActive=""false""""" and it returns dssetprop User-21 "isActive="false"" and fails becuase of the quotes around the string
– Hammertime
Nov 15 '18 at 12:28
Because you have stated that the CMD uses = as a delimiter is the reason I need to escape it so it ignores it as a delimiter and treats it as a character
– Hammertime
Nov 15 '18 at 12:31