Jump to content

Recommended Posts

Posted (edited)

I know the below is not correct but hopefully it gives the general idea of what I am wanting to do.

RunWait(@COMSPEC & " /cd $location rename *.$fileextension *.$newextensionname")

so in the command window it would perform a CD command to change current dir (press enter)

the pull in the vars for the current extension and the extension to be renamed to.

Edited by jbsoccerbrit
Posted

C:\Documents and Settings\****\Desktop\test.au3(62,1) : ERROR: syntax error

(

^

C:\Documents and Settings\****\Desktop\test.au3(62,82) : ERROR: syntax error

(@COMSPEC & " /cd " & $someText2 & " rename *." & $someText1 & " *." & $someText3)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Documents and Settings\****\Desktop\test.au3 - 2 error(s), 0 warning(s)

Posted (edited)

RunWait(@COMSPEC & ' /c ' & 'rename "' & $location & "*." & $fileextension & '"' & " *." & $newextensionname, "",@SW_HIDE)

[edit] This one I've tested! If you have spaces in the directory name, you have to enclose that: "bla bla" or 'bla bla'

Edited by taietel
Posted

Is there anyway to make the location change first so its cd $location and then the rename folders suit?

I.E

CD $location

rename *.ext1 *.ext2

Otherwise I dont think it will work thank you kindly for the help :idea:

Posted

Here is another working example (change it to your needs):

$location = "tempx"
$fileextension = "chm"
$newextensionname = "mih"
RunWait(@COMSPEC & ' /c ' & 'cd "' & $location & '"',"",@SW_HIDE)
RunWait(@COMSPEC & " /c " & "rename *." & $fileextension & " *." & $newextensionname, $location,@SW_HIDE)
Posted

unfortunately the two runwaits would have to be merged into one line otherwise once the CD (Change Directory) is done and closes the rename isn't applied to anything.

I've tried filemove and it just seems to delete the file... at a loss with this.

Posted (edited)

 I've merged it in one line (I've tested it - working!):

RunWait(@COMSPEC & " /c " & "cd '" & $location & "' & rename *." & $fileextension & " *." & $newextensionname, $location,@SW_HIDE)

[edit] Why did you use filemove?

Edited by taietel

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...