Zumasys Homepage
Forum Home Forum Home > AccuTerm > Scripting & Automation
  New Posts New Posts RSS Feed - Script not working on Windows Server
  FAQ FAQ  Forum Search   Register Register  Login Login

Script not working on Windows Server

 Post Reply Post Reply
Author
Message
jimh140 View Drop Down
Newbie
Newbie


Joined: September 17 2019
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote jimh140 Quote  Post ReplyReply Direct Link To This Post Topic: Script not working on Windows Server
    Posted: September 17 2019 at 7:31am
I am trying to run a script from a basic program to copy a file from one location to another. I have the script working successfully on a Windows10 system but it fails to work on a Windows 2016 server. I've checked permissions on the folders and users have full control on the folders copying from and copying to. Since it works on a windows 10 system, I believe it's some setting on the server perhaps blocking it or perhaps some setting in the AccuTerm on the server?

It is interesting that I can from a windows command line run the copy successfully.

The command is simply -

CMD = 'copy ""C:\Demo\pdf26.pdf"" ""C:\Customer\C7102\pdf26.pdf""'
*
SCRIPT = 'On Error Resume Next':CHAR(25)
SCRIPT = SCRIPT:'x=Shell("':CMD:'",0)'
CRT CHAR(27):CHAR(2):'P':SCRIPT
Back to Top
Shrek59 View Drop Down
Senior Member
Senior Member


Joined: December 04 2006
Location: New Zealand
Status: Offline
Points: 189
Post Options Post Options   Thanks (0) Thanks(0)   Quote Shrek59 Quote  Post ReplyReply Direct Link To This Post Posted: September 17 2019 at 2:12pm
Where are you expecting the copy to occur? An AccuTerm script always runs on the client.

Is your Windows 10 system both the server and the client? If so, that is why it works there. (As I expect that the Server 2016 is acting solely as a server, and you are using Windows 10 as the client).

If you want to copy stuff on the server, then make sure you run the copy commands on the server (not the client). Usually, this is done by shelling out to the O/S and then using the O/S copy command.

HTH

Brian
Back to Top
jimh140 View Drop Down
Newbie
Newbie


Joined: September 17 2019
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote jimh140 Quote  Post ReplyReply Direct Link To This Post Posted: September 18 2019 at 7:15am
In this case I'm actually running AccuTerm on the server, it's kind of a demo/development system. I have a separate system on Windows10 where the script works but on the system on the server it doesn't. So I'm actually working on the server in AccuTerm.
Back to Top
jimh140 View Drop Down
Newbie
Newbie


Joined: September 17 2019
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote jimh140 Quote  Post ReplyReply Direct Link To This Post Posted: September 18 2019 at 9:20am
So I figured out the problem but wondering about a solution. The files being copied had spaces in the names and that was causing a failure on the copy, it seems Windows10 interprets the copy differently then Windows Server 2016.

A command like

x = shell("copy ""C:\Scans\Test Page.pdf"" ""C:\Vendor\Test Page.pdf""",0)

works on Win10 but not WinServer2016

Changing it to

x = shell("copy "C:\Scans\Test Page.pdf" "C:\Vendor\Test Page.pdf"",0)

causes an 'Expecting ')' error

and using

x = shell('copy "C:\Scans\Test Page.pdf" "C:\Vendor\Test Page.pdf"',0)

gives the same ')' error

I can put this in a batch file and execute that and it will work

Just wondering how you can do a copy from a shell command with file names containing spaces
Back to Top
Shrek59 View Drop Down
Senior Member
Senior Member


Joined: December 04 2006
Location: New Zealand
Status: Offline
Points: 189
Post Options Post Options   Thanks (0) Thanks(0)   Quote Shrek59 Quote  Post ReplyReply Direct Link To This Post Posted: September 18 2019 at 2:11pm
So, what you are really wanting is to copy a file (or files) on the SERVER. If that is the case, I wouldn't use AccuTerm scripting - even if the client IS the server - simply because you are operating in a "special case" instance. Other users who connect to the server from remote clients will have the copy occurring on their LOCAL machine rather than the server where you intend the copy to take place.

Spaces in file names always make things problematic. I would write a batch file with a command like:

  COPY srcpath:srcfile destpath

and then EXECUTE that batch file from within your DB environment (using whatever syntax is appropriate). When it comes to dealing with spaces, it is always easier to get that working as DOS command and execute that command in a batch file, than to "escape" the command for direct execution.

Cheers,

Brian
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.