cardguy1000 Posted May 12, 2005 Posted May 12, 2005 (edited) Hi guys, I'm semi new to autoit and I can't seem to locate a function to move up X amount of directories. For instances say my script is in C:\test\test2\test3 and I want to run a file within C:\test\difFolder without explicitly declaring C:\test\difFolder, but rather only difFolder declared. So is there a way I could have the script go up 2 directories (regardless of the directories names) then switch to difFolder and execute a given file name? Something like this... $filename = 'myFile.exe' $itsFolder = ''\difFolder\' $newDir = dirUp(@ScriptDir, 2) ;assuming dirUp is the function name $newDir = $newDir & itsFolder & $filename Run($filename) Edited May 12, 2005 by cardguy1000
w0uter Posted May 12, 2005 Posted May 12, 2005 (edited) Hi guys, I'm semi new to autoit and I can't seem to locate a function to move up X amount of directories. For instances say my script is in C:\test\test2\test3 and I want to run a file within C:\test\difFolder without explicitly declaring C:\test\difFolder, but rather only difFolder declared. So is there a way I could have the script go up 2 directories (regardless of the directories names) then switch to difFolder and execute a given file name?Something like this...$filename = 'myFile.exe'$itsFolder = ''\difFolder\'$newDir = dirUp(@ScriptDir, 2) ;assuming dirUp is the function name$newDir = $newDir & itsFolder & $filenameRun($filename)<{POST_SNAPBACK}>just use \..\c:\windows\system\..\ = c:\windows\Func dirUp($s_path, $i_times = 1) If $i_times = 0 Then Return $s_path $s_path &= '\..' For $i = 1 To $i_times $s_path &= '\..' Next Return $s_path EndFunc ;==>dirUp Edited May 12, 2005 by w0uter My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll
bshoenhair Posted May 12, 2005 Posted May 12, 2005 Hi guys, I'm semi new to autoit and I can't seem to locate a function to move up X amount of directories. For instances say my script is in C:\test\test2\test3 and I want to run a file within C:\test\difFolder without explicitly declaring C:\test\difFolder, but rather only difFolder declared. So is there a way I could have the script go up 2 directories (regardless of the directories names) then switch to difFolder and execute a given file name?Something like this...$filename = 'myFile.exe'$itsFolder = ''\difFolder\'$newDir = dirUp(@ScriptDir, 2) ;assuming dirUp is the function name$newDir = $newDir & itsFolder & $filenameRun($filename)<{POST_SNAPBACK}>My question is why ? I'm not able to see the logic behind your request.You know the name of the file but not the dir right ?Why not just search for the file to get the path then execute it ?
MHz Posted May 13, 2005 Posted May 13, 2005 (edited) 2 directories up. FileChangeDir('..\..\difFolder') use @WorkingDir to store the current directory, if needed. Edited May 13, 2005 by MHz
cardguy1000 Posted May 14, 2005 Author Posted May 14, 2005 Thanks guys that's exactly what I was looking for.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now