Saved Bookmarks
| 1. |
Solve : how i move a file with batch file ?? |
|
Answer» hi move "%1" "D:\my folder"Dias's suggestion should do it for you. I am curious though. 1. Why do you want to "MOVE" executable files so often that you need it added to the right-click? 2. Are you sure that you want to "MOVE" the executable files? Or did you mean "COPY" them? You will NOT be able to use them for their original intended purpose if you "MOVE" them.Quote move "%1" "D:\my folder"dont work :- whats problem ? hey llmeyer1000 move is e.g i want for other purpose ...Quote from: Mental on May 17, 2008, 08:21:16 AM Quotemove "%1" "D:\my folder"dont work :- It will work if you do it properly. Quote from: Mental on May 17, 2008, 08:21:16 AM hey llmeyer1000 Please explain "other purpose" and your windows version. I can't imagine any useful purpose for moving executable files. I'm not going to help you screw around with your friends if that is your purpose. Also, what did not work with Dias's command line? What were the error messages? We can't figure out what is wrong without information, which you refuse to give. Answer the questions I posted earlier.Quote It will work if you do it properlymaybe ! Quote Please explain "other purpose" and your windows version. I can't imagine any useful purpose for moving executable files. I'm not going to help you screw around with your friends if that is your purpose.i was writen one app for sony ericsson , in new version i want my app easily for use !! so i decide put one option in right click ... my app work on THM files but maybe some one dont have this file but all have exe file (for help me) ... im using sp3 Quote Also, what did not work with Dias's command line? What were the error messages?i dont know ! without error massage , just for moment cmd screen open then quicly it closed !! ((sorry for my english))What is in c:\test.bat? Quote from: Mental on May 17, 2008, 12:57:52 PM im using sp3Does that mean Windows XP SP3? The reason we ask is that certain commands are not available in all versions of Windows, and may also work a bit differently in one version than another. Quote from: Mental on May 17, 2008, 12:57:52 PM QuoteAlso, what did not work with Dias's command line? What were the error messages?i dont know ! without error massage , just for moment cmd screen open then quicly it closed !! Add one or more pauses to your batch file so that you can read the error message before the CMD Window closes. Example: Code: [Select]@echo off move "%1" "D:\My Folder" pause exit Have you already created the destination folder? If not, your code should look more like this: Code: [Select]@echo off md "D:\My Folder" move "%1" "D:\My Folder" pause exit Remove the pause after debugging the batch file. OK, I tried the code with the pause as I suggested. You are right. It does not work. ( Sorry Dias ) Plus the error message is rather cryptic. Quote The syntax of the command is incorrect.This is the problem. %1 is already in quotes by default. You must not add them, or the command will fail with the error above. The following code does the job with or without the destination folder being present. Code: [Select]@echo off if not exist "D:\My Folder" md "D:\My Folder" move %1 "D:\My Folder" Thx llmeyer1000 & Dias de verano, it work for me without " " in the batch file @Dias may you test it without " " (in the batch) and tell me your result ? ThxQuote from: Dias de verano on May 17, 2008, 02:02:17 PM What is in c:\test.bat? Dias, a lot is lost to us because of Mental's English. I missed much of what he has meant in several of his posts.(including in this thread.) After reading through the thread several times, I think I finally understand most of it. Mental, Is the following explanation of "What I "THINK" you meant" ACCURATE? "NOTHING" was in Mental's "test.bat" at the start of this thread. He wanted to know how to use the name of the executable file in the batch file "c:\test.bat" He was trying to show us how he intended to add an action to the right click, and then perform some action on the file. (Moving it was only an example.) If I DECIPHERED it correctly, all he really wanted to know was this. Quote How do I use the name of the file I just right-clicked on in the action file "c:\test.bat"?The answer should have been: Quote The filename you just right-clicked on is represented by the environment variable %1 in the action you just called. (In this case it is "c:\test.bat".)Quote "NOTHING" was in Mental's "test.bat" at the start of this thread. He wanted to know how to use the name of the executable file in the batch file "c:\test.bat"yeah exactly |
|