• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

More batch file head aches...

Sam443

Senior member
When you set the %1 command parameter in Windows, and you double-click on an item, it replaces the whole file name (ie.. filename.extension) in the %1 parameter.

The thing is I need to use the name WITHOUT the extension. (ie, when I double click on a file, I want it to just replace the %1 with filename (no extension!))

Any ideas? 🙂
 
you need to provide a little bit more info. but there are options here.

- you could supply your own file extension if one is needed
example:

copy filename* %1.txt

this would result in copying a filname of of: document.log to document.log.txt
this would be a valid filename.

- you could set delimiters to define what part of the filnename you wish to insert.
example:

for /f "tokens=1-5" %%A in ('now') do set filename=%%B%%C%%E.txt
echo. >"S:\BackupResults\%filename%"
echo. >>"S:\BackupResults\%filename%"
echo. >>"S:\BackupResults\%filename%"

now is a reskit utility for printing the date and time. what i've done here is use the current date as the naming convention for some log files used in a batch. using tokens, %%A, and set, i've defined which parts of the date/time stamp will be used for the variable "filnename". filename is a variable. you could say set var= instead. then "var" would be your variable. so now when this is run, I get a log file called "Sep132000.txt"

however, without more information, like sample lines from the script and a description of what it is you are trying to do, that's the best I can offer.
 
Back
Top