cancel
Showing results for 
Search instead for 
Did you mean: 

OS command line script - Need help

Former Member
0 Kudos

Hello everyone,

Have any one written a OS command line script for windows and executed it through the file adapter, run operating system command option.

Can you guys provide me the details about how to do it.

I have no idea about writing the script as well.

Can you help me to code a simple script to make directory and execute it through file adapter.

Regards

Rahul

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Rahul,

For OS Command Scirpts for Windows environment is nothing but Batch files.

Noramally you can write one or more commands in a file and save the filename in XI server dirctory with .bat extension.

Then you can directly call this batch file from Adapter OS command.

Regards,

Ananth

Former Member
0 Kudos

Hi Ananth,

Do you mean that i should write the commands in a text file one after another and save the file as .bat

How should i call this batch file from Adapter OS command.

How should i write the command.

Thanks and Regards

Rahul

Former Member
0 Kudos

Hi Rahul,

Yes, You have to write each command in a seperate line and save it in text file with .bat extension.

From Adapter OS command you can call like this..

D://server_dir//subdir//myCMDfile.bat

Regards,

Ananth

PS: Plz reward the useful posts.

Former Member
0 Kudos

Hi Ananth,

I have placed two commands in the batch file

mkdir \rahul\nawal\test\

copy Test.txt Test1.txt

The first is getting executed but the second doesnt

Please help

Thanks and Regards

Rahul

Former Member
0 Kudos

Hi Rahul,

Try giving complete filepath in copy command..

You can even use place holders like %f or %F in OS Command and XI will fill this with Actual filename from Fileadapter.

Regards,

Ananth

Former Member
0 Kudos

Hi Rahul,

If you want to get filename from Adapter use the following sample code:

File adapter OS Command: D://server_dir//subdir//myCMDfile.bat %F

Batch file:

copy %1 new_filename_with_path

Hope this solves your problem.

Regards,

Ananth

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

Just check these blogs,

/people/sameer.shadab/blog/2005/09/21/executing-unix-shell-script-using-operating-system-command-in-xi

/people/michal.krawczyk2/blog/2005/08/17/xi-operation-system-command--error-catching

Regards,

Bhavesh