Announcement
Collapse
No announcement yet.
How to construct a string with embedded double quotes
Collapse
X
-
Originally posted by Stuart McLachlan View Post
What do you mean by "sending the string to DOS" ?
Please post the line generating the "syntax error" and details of the error.
#DIM ALL
$x = "netsh.exe interface set interface ""Local Area Connection"" admin=enabled"
$eport = "Local Area Connection"
FUNCTION PBMAIN () AS LONG
LOCAL result AS LONG
REM z$="netsh.exe interface set interface " + $DQ + $eport + $DQ + " admin=enabled"
SHELL $x,0, EXIT TO result
IF result THEN
MSGBOX "Error" + STR$(result) + " enabling ethernet"
END IF
END FUNCTION
C:\Users\Ray>netsh.exe interface set interface ""Local Area Connection"" admin=enabled
Area is not an acceptable value for connect.
The parameter is incorrect.
Comment
-
Originally posted by Ray Crumrine View Post
#COMPILE EXE "E:\enable.exe"
#DIM ALL
$x = "netsh.exe interface set interface ""Local Area Connection"" admin=enabled"
$eport = "Local Area Connection"
FUNCTION PBMAIN () AS LONG
LOCAL result AS LONG
REM z$="netsh.exe interface set interface " + $DQ + $eport + $DQ + " admin=enabled"
SHELL $x,0, EXIT TO result
IF result THEN
MSGBOX "Error" + STR$(result) + " enabling ethernet"
END IF
END FUNCTION
C:\Users\Ray>netsh.exe interface set interface ""Local Area Connection"" admin=enabled
Area is not an acceptable value for connect.
The parameter is incorrect.
What error message do you get with: netsh.exe interface set interface "Local Area Connection" admin=enabled ( ie single doublequotes)
Comment
-
You want to enable/disable a network interface from PBWin
The code below worked for me change ePort to the network interface you need.
BUT this netsh command needs to be executed in eleveted rights (run as administrator) so right click your exe and run as administrator.
Code:#COMPILE EXE #DIM ALL FUNCTION PBMAIN () AS LONG LOCAL result AS LONG LOCAL x AS STRING LOCAL ePort AS STRING ePort = "WI-FI" 'x="netsh interface set interface name=" + $DQ + ePort + $DQ + " admin=DISABLED" x="netsh interface set interface name=" + $DQ + ePort + $DQ + " admin=ENABLED" ? x SHELL x ,0, EXIT TO result IF result THEN MSGBOX "Error" + STR$(result) + " enabling ethernet" END IF END FUNCTION
Comment
-
Originally posted by Ray Crumrine View Post
You're the man, Rod! I think I had a space between the equal sign and the "name= "Local... and it was blowing up.
Computers, picky. Thanks
You initially posted a question wth an apparently failing string and never told us what the "syntax error" was that you received.
After 21 posts, you finally posted allegedly failing code which bore no resemblance to your original supposedly failing string.
And none of your posted code has "name=" in it.
Comment
-
?Originally posted by Stuart McLachlan View PostWell, that was a big waste of time.. When I tried to debug it the debugger gave confusing results. Thanks again.
Comment
Comment