cardguy1000 1 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 Share this post Link to post Share on other sites
w0uter 4 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 Share this post Link to post Share on other sites
bshoenhair 0 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 ? Share this post Link to post Share on other sites
MHz 80 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 Share this post Link to post Share on other sites
cardguy1000 1 Posted May 14, 2005 Thanks guys that's exactly what I was looking for. Share this post Link to post Share on other sites