Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-10-2020, 11:22 AM
stlmill stlmill is offline
Registered User
 
Join Date: Feb 2017
Posts: 4
Using For /f with ^

In the a TelenetSSh2 session, I'm able to use the following line at the command prompt. For /f tokens^=4^ delims^=^" %a in (test.txt) do set(something =%a). For the life of me I can't get the syntax to work when I put the statement in a Vbscript.

objTab.Screen.Send "for /f tokens^=4^ delims^=^" %a in (test.txt) do echo %a do set(szresultid=%a)" & chr(13)

Compilation Error
Error: invalid character.

Any help would be greatly appreciated.

John
Reply With Quote
  #2  
Old 02-10-2020, 12:12 PM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 972
Dear John,

Quote:
Originally Posted by stlmill View Post
objTab.Screen.Send "for /f tokens^=4^ delims^=^" %a in (test.txt) do echo %a do set(szresultid=%a)" & chr(13)

Compilation Error
Error: invalid character.
Within a VBScript string ("this is a string"), literal quote characters (") must be escaped by doubling them up as in: ""
If you correct the coding mistake by properly escaping the literal " character you intend to send as part of the command, it should work better for you.

--Jake
Attached Images
File Type: png Forum_14063_Explanation.png (64.9 KB, 51 views)
File Type: png Forum_14063_Solution.png (33.9 KB, 53 views)
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support
Reply With Quote
  #3  
Old 02-10-2020, 02:12 PM
stlmill stlmill is offline
Registered User
 
Join Date: Feb 2017
Posts: 4
Jake Thanks

Jake
Thank you very much!! That work great!!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 01:12 PM.