From: Jackie on
Starting to doubt myself now since it's almost 3 am here. Way past my
bed time. Can't think properly. :(
From: Uno on
Jackie wrote:
> I tried to look more into this myself since I think I can get the
> picture now.
> The main shortcut...
> Target: C:\Windows\System32\cmd.exe /K call run.bat
> ".\gcc_eq32\Shortcut.bat"
> Start in: F:\
>
> "Start in" must point to an absolute path if it will be launched from
> anywhere other than F:\.
> Otherwise you can take away everything in "Start in".
>
> run.bat will set the current working directory,
> set wd=%~dp0workingdir
> ...
> cd /D %d%
> , before calling your Shortcut.bat script. The working dir would in this
> case be F:\workingdir. You can change it as you like.
>
> If you're interested, here you go...
> Folder structure: http://i43.tinypic.com/14cv1jm.png
>
> run.bat
> ----------------------------------------
> @echo off
> rem Sets up the correct working directory and the correct path for the
> app (or your Shortcut.bat?)
>
> setlocal enabledelayedexpansion
> set arg1=%1
> call :DeQuote arg1
> set wd=%~dp0workingdir
> set appPath=%~dp0%arg1%
>
> cd /D %wd%
> call "%appPath%"
>
> goto :eof
>
> rem Code from http://ss64.com/nt/syntax-dequote.html
> :DeQuote
> SET _DeQuoteVar=%1
> CALL SET _DeQuoteString=%%!_DeQuoteVar!%%
> IF [!_DeQuoteString:~0^,1!]==[^"] (
> IF [!_DeQuoteString:~-1!]==[^"] (
> SET _DeQuoteString=!_DeQuoteString:~1,-1!
> ) ELSE (GOTO :EOF)
> ) ELSE (GOTO :EOF)
> SET !_DeQuoteVar!=!_DeQuoteString!
> SET _DeQuoteVar=
> SET _DeQuoteString=
> GOTO :EOF
> ----------------------------------------
>
> Example Shortcut.bat
> ----------------------------------------
> @echo off
> rem Get directory for this script
> set dir=%~dp0
>
> echo Current dir: %cd%
> echo Dir for this script: %dir%
>
> echo Todo: Launch gcc stuff>todo.txt
> ----------------------------------------
>
> Output when running gcc.lnk
> ----------------------------------------
> Current dir: D:\script\workingdir
> Dir for this script: D:\script\gcc_eq32\
> ----------------------------------------
>
> Text printed to todo.txt goes into workingdir.


Thx, Jackie, I've got a bit of a learning curve, here, so I need to ask
what this source does:goto :eof

rem Code from http://ss64.com/nt/syntax-dequote.html
:DeQuote
SET _DeQuoteVar=%1
CALL SET _DeQuoteString=%%!_DeQuoteVar!%%
IF [!_DeQuoteString:~0^,1!]==[^"] (
IF [!_DeQuoteString:~-1!]==[^"] (
SET _DeQuoteString=!_DeQuoteString:~1,-1!
) ELSE (GOTO :EOF)
) ELSE (GOTO :EOF)
SET !_DeQuoteVar!=!_DeQuoteString!
SET _DeQuoteVar=
SET _DeQuoteString=
GOTO :EOF

I think we're gonna get this pretty soon, and my windows gfortran
capability will officially be big pimpin.
--
Uno

From: Jackie on
On 5/14/2010 06:14, Uno wrote:
> Thx, Jackie, I've got a bit of a learning curve, here, so I need to ask
> what this source does:
[snip]
":goto :eof" tells the script to go to "end of file" (exit the code
"block").
Please see the URL I included for the DeQuote function. It removes
quotes from a string. I use it to remove quotes from the argument you
can specify when launching run.bat from the link (*.lnk).

> I think we're gonna get this pretty soon, and my windows gfortran
> capability will officially be big pimpin.

I hope so. :) At least you can test my example here and see if it's how
you want it or not. And modify it as you like if you want to use it. :)
From: Uno on
Jackie wrote:
> On 5/14/2010 06:14, Uno wrote:
>> Thx, Jackie, I've got a bit of a learning curve, here, so I need to ask
>> what this source does:
> [snip]
> ":goto :eof" tells the script to go to "end of file" (exit the code
> "block").
> Please see the URL I included for the DeQuote function. It removes
> quotes from a string. I use it to remove quotes from the argument you
> can specify when launching run.bat from the link (*.lnk).
>
>> I think we're gonna get this pretty soon, and my windows gfortran
>> capability will officially be big pimpin.
>
> I hope so. :) At least you can test my example here and see if it's how
> you want it or not. And modify it as you like if you want to use it. :)

Jackie, we got a winner. It took me some time and fiddling to see how
easy the thing is I was asking for. The script is located in the same
directory that I want window, ergo:

@echo off
Title Build environment for 32-bit gfortran equation solutions

rem Sets up the correct working directory
rem Get directory for this script
set dir=%~dp0

echo Dir for this script: %dir%

cd %dir%

Thanks bunches,
--
Uno
From: Jackie on
On 5/14/2010 22:34, Uno wrote:
> Jackie, we got a winner. It took me some time and fiddling to see how
> easy the thing is I was asking for. The script is located in the same
> directory that I want window, ergo:
>
[snip]
>
> Thanks bunches,

Great, Uno! :)