How can i concatenate 2 strings in a batch file? I have for example "abc" and "def", and i want to turn it in "abcdef". How should I do it?
Note that I really HAVE that quotes in the string, how do I take them off?
Printable View
How can i concatenate 2 strings in a batch file? I have for example "abc" and "def", and i want to turn it in "abcdef". How should I do it?
Note that I really HAVE that quotes in the string, how do I take them off?
The double quotes write to a file when you use the Write file operator. Change it to something
like ... Print #1, "abc" and you will get in your batch file abc.
I dont want to write to a file, I just want to have something like a var..is it even possible at all in a batch file?
My batch file will receive as arguments this: "C:\" and "lol.jpg"
and i want it to be able to call my other program with this as argument "C:\lol.jpg"
as another question, is there any command in batch files to convert a short filename to a long filename?
as a yet another question, is it possible at all in the registry to pass as a argument (in folder extension thing) only the path of clicked file, or only the filename instead of passing the full pathfilename?
In your batch file you can receive passed parameters like so...
This takes a parameter of a filename without the extension to do a search forCode:REM %1 = SomeFileNameToSearchForWithAnyExtension
Dir %1.* /s
in the DOS command window. The "%" sign is like a variable to receive
passed parameters from the command line or shelled parameters, etc.
You are not getting my point. If i have a "C:\" path and try to search for the wildcard "*.jpg" I can't just put
Dir %1%2 as it will result as "C:\""*.jpg"
It worked for me. Here is my demo code.
VB Code:
Option Explicit Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _ ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long Private Const SW_SHOWNORMAL As Long = 1 Private Sub Command1_Click() Open "D:\Development\Test2.bat" For Output As #1 Print #1, "Dir %1%2.* /s" Close #1 End Sub Private Sub Command2_Click() ShellExecute Me.hwnd, "Open", "C:\Windows\System32\Cmd.exe", " /K D:\Development\Test2.bat D:\Development\ Test2", "D:\Development", SW_SHOWNORMAL End Sub
You are still not getting my point...the text thats being passed has quotes AROUND IT so what I get is not C:\ like in your example but it's "C:\"
Anyone...?
Can you post your code, maybe there is some other reason. If you are receiving it like "C:\""*.jpg" then
it must be the way your passing it or in your batch file your placing double quotes around the variables?
The program that's giving the "C:\" as argument can't be changed, so I just have to work with it.
What I need is some kind of way of manipulate strings through the batch file so I can take the quotes off and just do %path_without_quotes/*.jpg like you said
If you could strip out the double quotes before they are sent to the batch file then you could use the vb Replace
function. I dont think that there is a way to do it in DOS but I will look.