IfNotExist, %1% { MsgBox, 49,, Missing File Name Parameter... IfMsgBox, Cancel Return Return } Else { ; Example #6: Convert filenames passed in via command-line parameters to long names, ; complete path, and correct uppercase/lowercase characters as stored in the file system. Loop %0% ; For each file dropped onto the script (or passed as a parameter). { GivenPath := %A_Index% ; Retrieve the next command line parameter. Loop %GivenPath%, 1 LongPath = %A_LoopFileLongPath% MsgBox, 49,, The case-corrected long path name of file %GivenPath% is: %LongPath% IfMsgBox, Cancel Return FileRead, FileText, %LongPath% ; Read source file into Variable 'FileText' MsgBox, 49,, Just Read file %LongPath% into memory IfMsgBox, Cancel Return if not ErrorLevel ; Successfully loaded. { StringReplace, TargetFile, LongPath, .ovpn, -Mod.ovpn ; Create the path/name of the result file from the initial source file's name MsgBox, 49,, New content will be saved to %TargetFile% IfMsgBox, Cancel Return StringReplace, FileText, FileText, `r`n, `n, All ; Find all CRLF and replace it with LF FileDelete, %TargetFile% ; Delete target file, if it exists FileAppend, %FileText%, *%TargetFile%, CP0 ; Write 'FileText' contents into target file. FileText = ; Free the memory. } } }
However, I wasn't able to run it from the command line yet...
Maybe there are compiling options, I need to read more about...