syedzhasan Absent Member.
Absent Member.
2922 views

Executing a command

Jump to solution

I am trying to run xCopy command to copy an image file to a location. Below is my code, it runs without error but doesn't copy th efile. Please let me know what could be the reason... Thanks.

            hProcessId := ProcessInitialize ("C:\\Windows\\System32\\XCopy.EXE", PROCESS_DETACHED,
                  "C:\\Test\\Penguins.*"+" "+"C:\\Test\\create\\Test.*", "C:\\Test\\create\\",                   "C:\\Test\\create\\out.txt");
           ProcessSetEnv(hProcessId, "temp", "C:\\Test\\create\\");
           ProcessStart(hProcessId);

Tags (1)
0 Likes
1 Solution

Accepted Solutions
Highlighted
ckim9 Absent Member.
Absent Member.

RE: Executing a command

Jump to solution

It's much safer to use "CMD.EXE /C XCOPY C:\\test\\penguins.* C:\\test\\create\\test.*" as your sCmdLine. You probably don't need anything else unless you truly want this process to be detached. A detached process will run in parallel with your script and often that is NOT what you want. You want this process to come back to the script so that you can resume after successfully executing the command.

View solution in original post

0 Likes
4 Replies
Highlighted
ckim9 Absent Member.
Absent Member.

RE: Executing a command

Jump to solution

It's much safer to use "CMD.EXE /C XCOPY C:\\test\\penguins.* C:\\test\\create\\test.*" as your sCmdLine. You probably don't need anything else unless you truly want this process to be detached. A detached process will run in parallel with your script and often that is NOT what you want. You want this process to come back to the script so that you can resume after successfully executing the command.

View solution in original post

0 Likes
syedzhasan Absent Member.
Absent Member.

RE: Executing a command

Jump to solution

Thanks; it worked. It seems like to run a batch file I will have to run cmd command.

0 Likes
syedzhasan Absent Member.
Absent Member.

RE: Executing a command

Jump to solution

I copied various types of files and found out the it does not copy *.DBF, *.PPTX, and *.BIN files. Any known issue you are aware of?

0 Likes
ckim9 Absent Member.
Absent Member.

RE: Executing a command

Jump to solution

I don't believe Silk Performer has anything to do with not being able to copy the files you've mentioned. I suggest that you check the permission settings and try the same command manually to see how it works.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.