Executing KSH batch file located in specific folder


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Executing KSH batch file located in specific folder
# 1  
Old 05-26-2009
Lightbulb Executing KSH batch file located in specific folder

Ok apologies if this is trivial or doesn't make sense but I am quite new to korn shells;

So I have a .ksh batch file located in a folder of my choosing, I want to run this file in a korn shell.

The problem though is that I want to get VBA code to do this. I have (VBA) code which opens command prompt (cmd.exe) and runs a (one) command line.

So far I can get the kornshell to open, using the command line; "C:\\WINDOWS\\system32\\POSIX.EXE /u /c /bin/ksh -l". This opens the korn shell in a default directory. I guess I need to add to this line to get it to then go to the specified folder (which i obtain from the VBA code) and execute the batch file.

Looking around on the web I got the code below, but I can't get it to work; "C:\\WINDOWS\\system32\\POSIX.EXE /u /c /bin/ksh -l -c \"cd \\\"`chgpath -p '%L'`\\\";ksh\""

Any help would be greatly appreciated.
(Also could someone explain to me what each part of the above command actually does)

Thanks Chris
# 2  
Old 05-26-2009
I've never used ksh in a Windows environment but can't you just include the full path to the script on the command line?
Code:
"C:\\WINDOWS\\system32\\POSIX.EXE /u /c /bin/ksh full_path/script.ksh"

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell scripting for moving folder specific files into target directory of that country folder.

I need help to write shell script to copy files from one server to another server. Source Directory UAE(inside i have another folder Misc with files inside UAE folder).I have to copy this to another server UAE folder( Files should be copied to UAE folder and Misc files should be copied in target... (3 Replies)
Discussion started by: naresh2389
3 Replies

2. Shell Programming and Scripting

Copy specific file (different but same name) as folder name

I have to copy a particular file present in a main folder having part of the file-name present in many sub-folders to a new destination preserving the name of the source "part of the main folder" and previous file-name of the output file: Example: From /005_0/1000/005.xxx ->... (7 Replies)
Discussion started by: wappor
7 Replies

3. Homework & Coursework Questions

Shell Scripting , Moving Old file to specific folder

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: There are files stored like 14.Aug.2014.log, 15.Aug.2014.log etc. in a folder $HOME/log you need to find out all... (4 Replies)
Discussion started by: shajoftaj
4 Replies

4. Shell Programming and Scripting

Error while executing switch case for find and replace specific file. Help Me...

case "$inputs" in sapte) find /pools/home_unix/sapte/work/models/model -name "*.xml" exec rm -i {} \;; ckm1) find /pools/home_unix/ckm1/work/models/model -name "*.xml" exec rm -i {} \;; I am getting error like as below. ./menu1.sh: line 144: syntax error near unexpected token `)'... (4 Replies)
Discussion started by: lathigara
4 Replies

5. Shell Programming and Scripting

Executing a batch of files within a shell script with option to refire the individual files in batch

Hello everyone. I am new to shell scripting and i am required to create a shell script, the purpose of which i will explain below. I am on a solaris server btw. Before delving into the requirements, i will give youse an overview of what is currently in place and its purpose. ... (2 Replies)
Discussion started by: goddevil
2 Replies

6. Solaris

Is it possible to audit a specific folder or file in Solaris ?

Hi, I wish to audit access to a specific folder or file in Solaris. I have read the man pages for auditd, audit_control , audit_event but don't seem to find any clue. Has anyone tried this before ? Is it feasible ? Any advise is appreciated. Thanks Yik (5 Replies)
Discussion started by: ycheng08
5 Replies

7. Shell Programming and Scripting

How to copy specific file.txt in specific folder?

hye there... i have a problem to copy file in specific folder that will change the name according to host,time(%m%s) and date(%Y%M%D) example folder name: host_20100531.154101801 this folder name will always change... but i just want to copy the AAA.txt and BBB.txt file.. really need... (17 Replies)
Discussion started by: annetote
17 Replies

8. Shell Programming and Scripting

Execute commands to specific folder from input file

Hi, I have one text file input.txt, which has folders path as follows: /home/user/automate/abc /home/user/automate/abc/xyz /home/user/automate/test /home/user/automate/test2 /home/user/automate/test2/abc/Main In those folders i have .svn folder. 1) First i want to remove .svn like rm... (5 Replies)
Discussion started by: dragon.1431
5 Replies

9. Shell Programming and Scripting

Executing Windows batch file from UNIX

Hi everyone, let me get straight to the points. My manager wants to execute a remote batch file (on a Windows server) from a UNIX Machine, does anyone know if this is possible and what packages would be needed? Thanks p.s. Sorry i cant give OS specifics, we use most UNIX's; AIX, Solaris,... (5 Replies)
Discussion started by: flip387
5 Replies

10. Shell Programming and Scripting

Batch delete specific folder from user home directories

Hi! Need your help. How can I delete the cache folder of multiple user home directories via automatically executed shell script on a Mac OS X Server? Example: The userdata are stored on a Xsan Volume like this: /Volumes/Xsan/userdata/mike /Volumes/Xsan/userdata/peter... (2 Replies)
Discussion started by: nipodrom
2 Replies
Login or Register to Ask a Question