| 1. |
Solve : Pass Variable and a Variation to a batch file? |
|
Answer» I'm just ... brain dead. Here is what I would like to do. Microsoft Windows [Version 6.1.7601] What does your batch look like and is this the problem your running into? My guess is this is the issue with the extra .ts which is part of the file name so wildcard is passing filename.ts Quote from: RBraverman on October 06, 2016, 05:46:56 PM a .info extension that I need to rename I edited my reply after I re-read your question. Hmm, then I re-read it another time and my head imploded. You asked for two different things, didn't you? You said to rename the file and then wanted to have two copies of the .info file. Based upon your details this should copy the info file to an mp4 extension. Code: [Select]copy "%~dpnx1.info" "%~dpn1.mp4.info" and this will rename it. Code: [Select]ren "%~dpnx1.info" "%~n1.mp4.info" Quote from: foxidrive on October 06, 2016, 10:56:35 PM I edited my reply after I re-read your question. MANY THANKS for replying, I just knew I'd make this more complicated .... You are right, convert a file with the passed video.ts (to video.mp4) and copy a file associated with it with the name of video.ts.info (separate text file) to video.mp4.info. I have tried what you suggested before and now again and this is what I get (which is driving me crazy, I might add), which is why I put it away for a week or two: [attachment deleted by admin to conserve space]Alot easier and quicker to copy and paste from the cmd window to the forum then making a screenshot. You can see from your file listing that the file you are trying to copy does not exist. So I am confused as to what you are trying to do.I see what you are doing now. You are trying to run the batch file with just the ts.info file. The code you were given assumed you were processing the base .ts file and the copy code would find the ts.info file and rename it based on the .ts file name. Quote from: Squashman on October 07, 2016, 08:21:33 AM A lot easier and quicker to copy and paste from the cmd window to the forum then making a screenshot. I tried but couldn't. Sorry. Quote from: Squashman on October 07, 2016, 08:21:33 AM You can see from your file listing that the file you are trying to copy does not exist. So I am confused as to what you are trying to do. Ok, I knew I wasn't going to be clear - the inuithighkick.ts.info does exist - that is the file that is to be copied to inuithighkick.mp4.info Quote from: Squashman on October 07, 2016, 08:31:47 AM I see what you are doing now. You are trying to run the batch file with just the ts.info file. The code you were given assumed you were processing the base .ts file and the copy code would find the ts.info file and rename it based on the .ts file name. I didn't use the processing of the video.ts file as that will take 20 minutes - just to see if the info file copies. Ok, lemme try the full batch. Again sorry - I should have seen that. DANDY. I didn't use %~dpnx1, I was trying to use %~n1 - and, needless-to-say - I got a copy of the video with a info extension. Can you explain what's happening here? My understanding of %~dpnx1 wouldn't WORK here.You can read about all the variable modifiers by opening up a cmd prompt and typing for /? Here is the snippet you want to look at. Code: [Select]In addition, substitution of FOR variable references has been enhanced. You can now use the following optional syntax: %~I - expands %I removing any surrounding quotes (") %~fI - expands %I to a fully qualified path name %~dI - expands %I to a drive letter only %~pI - expands %I to a path only %~nI - expands %I to a file name only %~xI - expands %I to a file extension only %~sI - expanded path contains short names only %~aI - expands %I to file attributes of file %~tI - expands %I to date/time of file %~zI - expands %I to size of file %~$PATH:I - SEARCHES the directories listed in the PATH environment variable and expands %I to the fully qualified name of the first one found. If the environment variable name is not defined or the file is not found by the search, then this modifier expands to the empty string The modifiers can be combined to get compound results: %~dpI - expands %I to a drive letter and path only %~nxI - expands %I to a file name and extension only %~fsI - expands %I to a full path name with short names only %~dp$PATH:I - searches the directories listed in the PATH environment variable for %I and expands to the drive letter and path of the first one found. %~ftzaI - expands %I to a DIR like output line Quote from: RBraverman on October 07, 2016, 10:03:24 AM I didn't use the processing of the video.ts file as that will take 20 minutes - just to see if the info file copies. A way to test it could have been to use a video file that was 2 seconds long. Ask direct questions if you still have trouble understanding the info Squashman has shown you. |
|