Problem to line

I get error

File name does exist

to line

Shell (Command0)

Open in new window

while Command0 is having value

rename "C:\cmp3g\CODECO_ERROR_a\CNESI_CNSNHEPI_20171108095055_958.ERR" "CNESI_CNSNHEPI_20171108095055_958.edi" 

Open in new window

LVL 12
HuaMin ChenProblem resolverAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewIT / Software Engineering ConsultantCommented:
The RENAME command is not an actual program (.EXE) in Windows, but rather just a command that is available from the command interpreter.  To use it you need to load the command interpreter first and then pass it the command to execute.  Adjust as bellow before the Shell() command.  You can do CMD /H at a command prompt to get additional info on it's command line options.

Also since we want to include the double quotes around the file names in the command0 string, we have to double them up inside the outermost double quotes.

Command0 = "cmd /c rename ""C:\cmp3g\CODECO_ERROR_a\CNESI_CNSNHEPI_20171108095055_958.ERR"" ""CNESI_CNSNHEPI_20171108095055_958.edi"""

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.