Jump to content

Recommended Posts

Posted

I have simple script utilizing CMD Xcopy commands

This simple script is compiled and made to xcopy files from one place to its root.

I also made new script which executes previously described compiled script as well as other CMD.bat files and many other executables.

Execution is done simply by

Run (@ComSpec & ' /c ' & '"' & IniRead (@ScriptDir & "\Settings.ini","Components","Path1","") & '"')

or

Run (IniRead (@ScriptDir & "\Settings.ini","Components","Path1",""))

ISSUE:

Executed script's or *.bat think that they located at where my script is (which i use to execute them)

For example:

C:\Executor.au3 executes D:\test.bat

test.bat has simple lines

mkdir folder
Xcopy %source%\folder\file.ext

When this test.bat executed, CMD window says that this batch runs from C: instead of D: where its located and copies files into C:\folder instead of D:\folder as it was programed to.

Anyway to fix this ? Maybe rights issue or something ?

Thanks in advance

Posted

Maybe i somehow need to convert full path to executable batch to path only and set it as its working directory ?

But i dont know how to convert F:\Installed programs\Azureus\Start Azureus.bat to F:\Installed programs\Azureus

Posted (edited)

thanks i didnt know this function existed and was in help file.

Dim $szDrive1, $szDir1, $szFName1, $szExt1
$GetPath1 = _PathSplit(IniRead (@ScriptDir & "\Settings.ini","Components","Path1",""), $szDrive1, $szDir1, $szFName1, $szExt1)
$ReturnPath1 = _ArrayToString ($GetPath1,"",1,2)
Run (IniRead (@ScriptDir & "\Settings.ini","Components","Path1",""),$ReturnPath1)

I created this code for each 10 fileopen dialogs and i wonder if there is another simpler way to make this code smaller.

I do not yet understand how "Dim" works and whats its for, so if anyone would explain it would be great help.

Thanks again for function

Edited by madasraka

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...