Re: Batch files

Anyone remember enough about batch files to know how to handle modern

> _long_ filenames? > > I want to execute... > > C:\\NewsProxy\\NewsProxy.exe > > then execute... > > C:\\Program Files\\Agent\\agent.exe > > ...Jim Thompson >

XP still uses the 8.3 notation. In your case:

c:\\progra~1\\Agent\\agent.exe

or c:\\NewsPr~1\\NewsPr~1.exe

The funny thing in XP is if you use the auto-complete it'll show the full name in the path, if you use the notation I've shown it'll use that notation.

That could cause some problems but I doubt it.

Reply to
T
Loading thread data ...

it's not the length of the filename/path that's the problem, it's the space. filenames/paths with spaces needs to be in quotes.

-Lasse

Reply to
langwadt

If you are using XP you can enclose the pathname in quotes and use the long filenames like the GUI environment does. I wrote a backup batch files that does that, and it works nicely. If not the easy way to remember is to limit the characters to the first 6 then add the ~1 to the end. If the sixth character is a space, then it becomes the first character of the next word. So "my documents" becomes "mydocu~1" and "myfiles" will not change at all, but "my files" will become "myfile~1". If the first 6 characters of the next item are the same then the end get the ~2 and so on.

- Tim -

Reply to
Tim

I thought it would be handy to see the actual xcopy command I used in the batch file.

xcopy "C:\\Documents and Settings\\Tim\\My Documents" "q:\\timback\\My Documents" /s/v/h/e/i/r/o/x/y

That command copied the contents of the "My Documents" folder to drive Q, created the folder (timback was previously created), and verified the copy.

The final version had several of these lines to complete a backup system for a customer. It was very fast and easy for them to use, so backups now get done regularly.

- Tim -

Reply to
Tim

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.