Prev: SetWindowLongPtr fails when window is subclassed for some cases.
Next: Example of Precompiled Headers?
From: Uno on 11 May 2010 19:23 Jackie wrote: > You can forget about the last thingy I said in my previous post. I > realized it is the working directory set on a shortcut like you said. > Maybe there's still something to it by adding /D after "cd" like in my > previous post? Jackie, I don't think we're going the right direction here. http://i44.tinypic.com/rkn1wx.jpg Any other ideas? -- Uno
From: Jackie on 11 May 2010 19:26 Yeah, that doesn't look right. I was thinking inside your Shortcut.bat script where you are using "cd" already, but maybe it's no good after all.
From: Uno on 11 May 2010 19:47 Jackie wrote: > Yeah, that doesn't look right. I was thinking inside your Shortcut.bat > script where you are using "cd" already, but maybe it's no good after all. Except, of course, that by progressively guessing we're gonna get this. :-) This is what JVB wrote: > Next, start up another instance of Windows Explorer and using the > right mouse button, drag and drop C:\WINDOWS\system32\cmd.exe to the > root directory of your thumb drive and select Create Shortcut from > the drop down menu. Right-click on the shortcut, select Properties, > and under the General tab change the name to > Command Prompt for 32-bit gfortran > Under the shortcut tab, change the target to > C:\WINDOWS\system32\cmd.exe /K %cd:~0,2%\gcc_eq32\Shortcut.bat > Change Start in to > %cd:~0,2%\gcc_eq32 > And under the Options tab, make sure that QuickEdit mode > and Insert mode are checked. Click on OK, and you should have > a working thumb drive installation. I'm gonna go back over to windows and see if I can Fiddle with the options a little more. Cheers, -- Uno
From: Jackie on 11 May 2010 20:10 On 5/12/2010 01:47, Uno wrote: If it can be of any help to you, you can get the directory of the current script with %~dp0
From: Jackie on 11 May 2010 20:43 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.
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: SetWindowLongPtr fails when window is subclassed for some cases. Next: Example of Precompiled Headers? |