![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | HTA calls cmd-batch, but which path? I am making a hta program that shows two buttons: "Continue" and "Stop". When pressing the "Continue" button, the program (VbScript) calls several cmd batch programs that are stored in a subdirectory "Data-Exe". These cmd programs check the existence of source directories, destination directories and copy data from other subdirectories (DataToBeCopied) that are located inside "Data-Exe". These cmd programs work fine when I run them seperately. However, when the hta starts them they are running from the main directory (update) and not from the directory they reside in,"Data-Exe". This means that the cmd programs react differently to the paths they are programmed with when running from another location. This means I have to reprogram the cmd's. This also means that I can either run the cmd's alone or from the hta, but not both? How do I deal with this kind of behaviour? How do I make these cmd programs work from the hta AND as a stand alone? Is this something that is defined in the hta, or is it a cmd issue? #Example from directorie structure. F: | +---update | Program.hta | \---Data-exe | 01-update_toepassingen.cmd | \---DataToBeCopied data.txt #Part of the the script <script language="VBScript"> '---------------------- Sub RunJob Const NORMAL_WINDOW = 1 Set objShell = CreateObject("Shell.Application") objShell.ShellExecute "Data-Exe\01-update_toepassingen.cmd", , , , NORMAL_WINDOW window.close() End Sub '---------------------- Sub QuitJob 'Msgbox "Installatie afgebroken. Tot ziens." window.close() End Sub '---------------------- </script> <body><br><br> <input id=runbutton type="button" value="Ga door" name="run_button" onClick="RunJob"> <input id=runbutton type="button" value="Stop" name="quit_button" onClick="QuitJob"> </body> #Part of the the cmd @Echo off Echo ############################### > c:\temp\01-log-IB-StandaardApps.txt Echo update gestart door %username% op %DATE% om %TIME% >> c:\temp\01-log-IB-StandaardApps.txt Type InfoTxt\ScreenTxt-01.txt echo Hallo %username% REM Kopieer Infosnap en andere MDL-applicaties naar de C:-schijf COPY "mdl\*.*" "C:\Program Files\Bentley\Program\MicroStation\mdlapps\" /v/y >> c:\temp\01-log-IB-StandaardApps.txt XCOPY "documentation\*.*" "C:\Program Files\Bentley\Documentation\*.*" /e/h/y >> c:\temp\01-log-IB-StandaardApps.txt echo Tot ziens %username% CLS Echo update klaar op %DATE% om %TIME% >> c:\temp\01-log-IB-StandaardApps.txt Echo ############################### >> c:\temp\01-log-IB-StandaardApps.txt Exit -- I fixed it right the first time. It must have failed for other reasons. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: HTA calls cmd-batch, but which path? Dramklukkel wrote: Quote: > I am making a hta program that shows two buttons: "Continue" and "Stop". > When pressing the "Continue" button, the program (VbScript) calls several > cmd batch programs that are stored in a subdirectory "Data-Exe". These cmd > programs check the existence of source directories, destination directories > and copy data from other subdirectories (DataToBeCopied) that are located > inside "Data-Exe". > > These cmd programs work fine when I run them seperately. However, when the > hta starts them they are running from the main directory (update) and not > from the directory they reside in,"Data-Exe". This means that the cmd > programs react differently to the paths they are programmed with when running > from another location. This means I have to reprogram the cmd's. This also > means that I can either run the cmd's alone or from the hta, but not both? > > How do I deal with this kind of behaviour? > How do I make these cmd programs work from the hta AND as a stand alone? > Is this something that is defined in the hta, or is it a cmd issue? > It's easy to overcome this issue in batch (presuming your windows flavour is not w9x/Me). In the batch change temporarily into the folder the batch is residing in. @echo off pushd "%~dp0" :: place your batch-code :: here popd HTH Matthias |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Batch-file not working: PATH-problem? | Vista General | |||
| Vista: Batch file cannot find path of exe | Vista General | |||
| Vista: Batch file cannot find path of exe | Vista General | |||
| BUG? (Test-Path $path -IsValid) and empty $path | PowerShell | |||
| BUG/ANNOYANCE: PoSH autocompletes the full path rather than a minimal path | PowerShell | |||