LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 02-06-2012, 11:57 PM   #1
sarenace
Member
 
Registered: Feb 2012
Posts: 46

Rep: Reputation: Disabled
Executable cygwin script in windows


Hello,
I have a cygwin command/bash script that I want to run on a group of txt files in a folder in windows. Basically, I want to make a .bat file that can be copied into the folder containing my files, and can be double clicked to open a cygwin window that will run the script from within the folder and stay open to show the output.
So if my folder is c:/stuff, I copy the bat file to c:/stuff, then double click the bat file to open a cygwin bash shell at /cygdrive/c/stuff which runs myscript on the txt files contained therein. Is this possible? and how may it be achieved.

Whenever i make a bat file in notepad containing the line c://cygwin/bin/bash.exe mycommand it opens a bash shell within that working directory but doesnt run the script, and none of the commands work.
 
Old 02-09-2012, 03:31 PM   #2
trbennett48
LQ Newbie
 
Registered: Apr 2011
Posts: 17

Rep: Reputation: 2
Below is a copy of a script I use to
"start" an X-window session.

The script is called startx.bat, and
I invoke it by double clicking its shortcut on my desktop.

You will notice that the commands in the
script are primarily "Windows" commands...
...Including invoking "bash"...
The trick is specifying the -C argument to bash, which tells it to "run this command".

Code:
@echo off

C:
chdir C:\cygwin\bin

bash -c "PATH=$PATH:/bin:/usr/bin;XWin -clipboard -logverbose 3 -ac -query cdcxvd0559.con-way.com -fp \"tcp/cdcxvd0559.con-way.com:8000,/usr/share/fonts/100dpi/,/usr/share/fonts/75dpi/,/usr/share/fonts/Type1/\" "
HTH,
-tony
 
Old 02-12-2012, 02:14 AM   #3
sarenace
Member
 
Registered: Feb 2012
Posts: 46

Original Poster
Rep: Reputation: Disabled
Thanks that really worked. Is there a way of compiling a shell script so it produces a standalone windows executable for friends who dont have cygwin?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash Script: Passing values from script to a c++ executable Timballisto Programming 3 03-09-2011 04:16 AM
[SOLVED] Linux Script loses its executable permission in Windows aanand0 Linux - Newbie 6 01-05-2011 04:50 AM
Convert python script to windows executable ankit_mcgill Linux - Newbie 4 10-05-2008 01:21 AM
Cygwin and space issue in a script. angel115 Programming 4 05-22-2008 07:43 AM
Help with Cygwin shell script? corbintechboy General 1 12-26-2007 10:59 AM


All times are GMT -5. The time now is 04:50 AM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration