batch files, current directory
Moderators: fgagnon, nikos, Site Mods
batch files, current directory
When I execute a batch file from any directory using explorer2, the shell starts in the zabkat folder (Program Files\...). Which means that I need fully-qualified paths coded in all of my batch files, or some logic to determine the current directory and then cd to it. I have many existing utility batch files that expect the shell to start in the current directory (which is the default behavior of Windows Explorer) and I do not want to have to modify them.
I do not want to use any of xplorer2's shell features, I just want it to behave like a dual-paned Windows Explorer replacement (which to an acceptable degree I have been able to configure it to be, until now).
Is there a way to configure xplorer2 to start shells in the current directory?
Thanks.
I do not want to use any of xplorer2's shell features, I just want it to behave like a dual-paned Windows Explorer replacement (which to an acceptable degree I have been able to configure it to be, until now).
Is there a way to configure xplorer2 to start shells in the current directory?
Thanks.
I can't uncheck that value; I find my self constantly deleting things, and it's quite annoying to have to remember to browse to another folder before I can delete (or receive an annoying error message). Any other way? This is kind of a deal-breaker for me, since I just recently had to put on the 'windows admin' hat, and I find myself knee-deep in shell scripts.
As for the second response, thanks!
As for the second response, thanks!
Maybe there's a way to change how a file with a given extension is executed? E.g. if filetype is 'cmd', change the environment before executing a shell script: cmd.exe /c <script to determine current directory> <cd to current directory> <execute desired script>
I don't know anything about the capabilities of this software, that's just pure speculation.
I don't know anything about the capabilities of this software, that's just pure speculation.
Is there no way to tell xplorer2 to run batch files / executables from the folder in which they reside? Surely that information is available. If I'm in File Explorer and double-click on a .bat / .cmd file, it executes the file from the folder it's in - I can't imagine ever wanting to run it from the xplorer folder.nikos wrote:the only other workaround would be to use full paths for all commands inside the script, e.g. using $F instead of $N
Thank you,
CmputrAce
I'm not sure what that's supposed to do, but I added as the first command in the batch file and it didn't work. I tested it from the command prompt and got:nikos wrote:you can put "cd $p" as the first command in the batch file
C:\>"C:\Program Files\Pentaho\ReportDesignWizard\reportwizard.bat"
C:\>cd $P
The system cannot find the path specified.
C:\Documents and Settings\jb78071>set PATH=C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;c:\sys;c:\sys\bin;I:\Program Files\IDM Computer Solutions\UltraEdit-32;C:\Program Files\Subversion\bin;
... and so on...
- FrizzleFry
- Platinum Member
- Posts: 1241
- Joined: 2005 Oct 16, 19:09
$P is an internal x2 variable. It can be used from x2's addressbar/commandline, in user commands, and from the script generator but it is not available from a batch file.
Just create a layout which has "Don't lock browsed folder" disabled and use it to execute batch files.
You can also use variable modifiers to get to the batch file's folder:
echo %~dp0
%~d0
cd %~p0
%0 is the batch file's name (including path)
%~d0 extracts the drive
%~p0 extracts the path
See "Using batch parameters" in Help and Support
Just create a layout which has "Don't lock browsed folder" disabled and use it to execute batch files.
You can also use variable modifiers to get to the batch file's folder:
echo %~dp0
%~d0
cd %~p0
%0 is the batch file's name (including path)
%~d0 extracts the drive
%~p0 extracts the path
See "Using batch parameters" in Help and Support