DigDeep Posted September 25, 2018 Posted September 25, 2018 This might sound weird. Sometime ago I had created a script to install an app and create it's shortcut. Didn't realize that I accidentally gave the shortcut extension as '.Ink' as an i instead of '.lnk' as an L. Now the issue is that I am able to delete the application and all it's dependencies except this shortcut file. If I want to upgrade the application with the correct extension as LNK file, I am getting 2 process running. Is there a way to get the .ink deleted? I tried FileDelete, Rename File and then delete (does not even rename), FileMove (Does not move). I already have #RequireAdmin declared at the top.
FrancescoDiMuro Posted September 25, 2018 Posted September 25, 2018 @DigDeep Something like this? expandcollapse popup#include <File.au3> CreateFiles() DeleteInkFiles() Func CreateFiles() Local $strFileName = "" ; InkFiles For $i = 1 To 10 Step 1 $strFileName = @ScriptDir & "\Files\InkFile" & $i & ".ink" If Not _FileCreate($strFileName) Then Exit ConsoleWrite("Error while creating file '" & $strFileName & "'. Error: " & @error & @CRLF) Next ; Lnk Files For $i = 1 To 10 Step 1 $strFileName = @ScriptDir & "\Files\LnkFile" & $i & ".lnk" If Not _FileCreate($strFileName) Then Exit ConsoleWrite("Error while creating file '" & $strFileName & "'. Error: " & @error & @CRLF) Next EndFunc Func DeleteInkFiles() Local $strFilesPath = @ScriptDir & "\Files", _ $arrInkFiles $arrInkFiles = _FileListToArray($strFilesPath, "*", $FLTAR_FILES, True) _ArrayDisplay($arrInkFiles, "Before deleting:") $arrInkFiles = _FileListToArray($strFilesPath, "*.ink", $FLTAR_FILES, True) If @error Then ConsoleWrite("Error while getting the list of files. Error: " & @error & @CRLF) Else For $i = 1 To $arrInkFiles[0] Step 1 If FileDelete($arrInkFiles[$i]) Then ConsoleWrite("The file '" & $arrInkFiles[$i] & "' has been deleted correctly." & @CRLF) Else ConsoleWrite("The file '" & $arrInkFiles[$i] & "' has not been deleted." & @CRLF) EndIf Next $arrInkFiles = _FileListToArray($strFilesPath, "*", $FLTAR_FILES, True) _ArrayDisplay($arrInkFiles, "After deleting:") EndIf EndFunc Cheers Click here to see my signature: Reveal hidden contents ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
BigDaddyO Posted September 25, 2018 Posted September 25, 2018 doesn't make sense that you can't delete it unless the file names are actually FileName.ink.lnk since if they were actually .ink they shouldn't have even worked.
DigDeep Posted October 4, 2018 Author Posted October 4, 2018 @FrancescoDiMuro and @BigDaddyO, sorry for the delay in response. I was off from machine for few days. @BigDaddyO yes you are correct. I later found in the file properties that it had FileName.ink.lnk extension.
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