Batch wildcards not accepted - batch-file

How do I do reshacker -extract on all files in the system32 folder as well as get their filename and add .rc to the end of each output file.
reshacker.exe does not accept wildcards so im not sure what to do.
I have tried the following:
ResHacker.exe -extract C:\windows\system32\*.*, C:\resources\%1.rc, dialog,,
it is supposed to extract dialog data from each file in system 32 and save this data as %the_filename%.rc.

Related

How to Log Teraterm into Text file by using Batch File

I am using Ttermpro.exe to run TTL file. After that, teraterm will display all the output. I want to insert the display in teraterm into logfile.txt by using batch file command. Any idea on how to resolve this problem?
"C:\Program Files (x86)\teraterm\ttermpro.exe" /L=C:\0465\PCU 90000465\UartLog.txt "C:\0465\PCU 90000465\COM.TTL"
I don't know if this answers your problem directly, but based on what I think you're saying, try:
In the teraterm ttl file, include this to avoid the logging command in TTermPro:
logopen 'C:\0465\PCU 90000465\UartLog.log' <binary flag> <append flag>
... more content
... and when done
logclose
The binary flag and append flag can both be set to zero, but you can find more info here: https://ttssh2.osdn.jp/manual/en/macro/command/logopen.html
Generally, I thought the log file was a .log extension, but if you really want it to become a .txt file, you could also add after the logclose function
filerename 'C:\0465\PCU 90000465\UartLog.log' 'C:\0465\PCU 90000465\UartLog.txt'
As far as the batch file goes, you'd simply change directories to the teraterm TTermPro executable and then run the command to execute the macro.
cd C:\Program Files\teraterm
TTERMPRO /M="C:\0465\PCU 90000465\COM.TTL"
but you can also achieve the same thing just using the TTPMacro as
cd C:\Program Files\teraterm
TTPMacro /M=C:\0465\PCU 90000465\COM.TTL
Just save one of those two sets of commands as a .bat file and that should hopefully work.

unrar with long file path

I have an .rar achive, when I use right click on file explorer, and use the menu "extract here", I can extract the files sucessfully. but when I use unrar.exe to extract the same achive, I got errors like can not find the specified path.
the path in problem is longger than 260 char.
my question is: how can I unrar a achive under bat file with long file path?

How to create a batch file that will zip few different files in one .zip file

I want to create a batch/shell script for windows and mac that will take few different files with different types and will compress it to a .zip file.
I already saw a few questions and answers about it, but all of them either compress all the files in the folder or compress them individually.
Example (look at attached image):
I have a folder that contains 1.txt, 2.xml, a sub directory.
And I want to turn all of them into a .zip file.
If possible to get a solution both for windows and Mac.
On Windows there is the file 7zip.chm in directory %ProgramFiles%\7-Zip which is the help file of 7-Zip. Double click on this file to open the help.
On Contents tab there is the list item Command Line Version with the help pages:
Syntax ... Command Line Syntax
Commands ... Command Line Commands
Switches ... Command Line Switches
The target is to compress everything in folder test into a ZIP file with name of the folder as file name.
This could be done for example with the command line:
"%ProgramFiles%\7-Zip\7z.exe" a -bd -mx=9 -r -y -- test.zip "C:\Path to Directory\test\*"
This command line adds (a) everything in directory C:\Path to Directory\test recursive (-r) to a ZIP file with name test.zip in current working directory without progress indicator (-bd) using best ZIP compression (-mx=9) with assuming Yes on all queries (-y).
In other words the file test.zip in current directory contains after execution the subdirectory main with everything inside and the files 1.txt and 2.xml.

in batch copy the file name but not file extention

So i am converting excel files into a .txt files using vbs, and the input file name needs to be the same as the output file name with the changed file extension obviously. Whats making this so hard is the fact that I using this as basically a file converter so the names of the files will be random.
The way I load the input file is by is using the %1 command and just pass in the input file after I call the batch like this.NOTE: the .xlsx can be changed to any .xlsx file that i need to convert.
C:\tabdim>conversion_batch_file.bat **C:\tabdim\2160707.xlsx**
In the batch file (C:\tabdim\conversion_batch_file.bat) Note: the rest of the sql has been replaced with x's.
%windir%\SysWow64\wscript.exe C:\tabdim\combined.vbs **%1**
sqlcmd - xxxxxxxxxxxxxxxxxxxx
bcp xxxxxxxxxxxxxxxx "**C:\tabdim\20160707.txt**" xxxxxxxxxxxxxx
sqlcmd - xxxxxxxxxxxxxxxxxxxx
If there was any way to do something like this
"%1- last 4 characters+".txt""
I know that is totally wrong syntax, I'm just kind of using words to describe kind of what I'm trying to have happen.

Opening all pdf files in a folder using cmd or bat file

I have a folder which have around 20 pdf files inside. Is there any way to open all the pdf in the folder in one shot like using something "* .pdf"?
IFF you are on Microsoft Windows and you have the correct association setup, you could do the following. Of course, there are other things to do like getting to or specifying the directory containing the .pdf files. If you put this into a .bat script, be sure to double the '%' characters on the variable.
FOR %f IN ("*.pdf") DO ("%~f")

Resources