Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-24-2018, 09:52 AM
mschaafs mschaafs is offline
Registered User
 
Join Date: Oct 2017
Posts: 27
Question Space in Path - Failed to open script file

Good morning, I am having an issue where the script argument being passed to SecureCRT has a space in the filepath and is not being fully read. For instance: "C:\Users\someuser\Documents\This Folder\script.js" is being seen as "C:\Users\someuser\Documents\This", and so is saying "The system cannot find the file specified." It is being passed via the script_path var in the following call:

Code:
nResult = objShell.Run( _
        Chr(34) & securecrt_path & Chr(34) & " /SCRIPT " & script_path & _
        " " & arguments & _
        " " & protocol & " /PASSWORD " & Password & _
        " " & Username & "@" & host, 5, True)
Reply With Quote
  #2  
Old 01-24-2018, 10:12 AM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 654
Hi mschaafs,

I'm sorry you're having trouble.

Some additional information may help in determining the best solution. When you say "script argument being passed to SecureCRT has a space in the filepath" which variable in the below code is the one you are having trouble with? Where is this variable/argument given its value?
__________________
Thanks,
--Eric

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 01-24-2018, 10:37 AM
mschaafs mschaafs is offline
Registered User
 
Join Date: Oct 2017
Posts: 27
Reiterate

Hi Eric, thank you for getting back with me, but all that is in the original post. The variable named "script_path" has the script path and it is a local path. When it doesn't have a space in the path, it works perfectly. Is there some special character I need to add in place of the space? Something like '%20' in a url?
Reply With Quote
  #4  
Old 01-24-2018, 11:23 AM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 654
Hi mschaafs,

I apologize, I missed that it was the script_path variable.

Where and how are you assigning the value to script_path?

You may be able to get the behavior you're looking for by ensuring that the "s get sent to the remote system. This can generally be done by using """value""". Please see the example below.

Code:
script_path = """C:\Users\someuser\Documents\This Folder\script.js"""
Does modifying your script in this way provide the behavior you're looking for?
__________________
Thanks,
--Eric

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #5  
Old 01-24-2018, 01:21 PM
mschaafs mschaafs is offline
Registered User
 
Join Date: Oct 2017
Posts: 27
Perfecto!

Hello Eric! That did the trick... and in fact, I just wrapped it in Chr(34) to do the same thing. I had actually done that already with the securecrt_path for another reason, so I had the answer all along. :P
Thank you again for your time and hopefully this helps someone else!

Code:
nResult = objShell.Run( _
        Chr(34) & securecrt_path & Chr(34) & " /SCRIPT " & _
        Chr(34) & script_path & Chr(34)  & _
        " " & arguments & _
        " " & protocol & " /PASSWORD " & Password & _
        " " & Username & "@" & host, 5, True)
Reply With Quote
  #6  
Old 01-24-2018, 01:28 PM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 654
Hi mschaafs,

I'm glad to hear you're up and running.

Have a great rest of the day.
__________________
Thanks,
--Eric

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
Reply

Tags
arguments , failed , path , script , space

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:04 AM.