.Bat = Replace spaces in a variable with _
micromega
Posted messages
141
Status
Membre
-
dubcek Posted messages 18702 Registration date Status Contributeur Last intervention -
dubcek Posted messages 18702 Registration date Status Contributeur Last intervention -
Hello,
I need to replace the spaces in the path returned by a variable with "_" (key 8):
"%Path%\Folder"
Is it possible?
Thank you
I need to replace the spaces in the path returned by a variable with "_" (key 8):
"%Path%\Folder"
Is it possible?
Thank you
5 réponses
Hello,
Surely with this:
https://ss64.com/nt/syntax-replace.html
.
--
Best regards,
Jordane
Surely with this:
Variable Edit/Replace
Use the syntax below to edit and replace the characters assigned to a string variable.
Syntax
%variable:StrToFind=NewStr%
%~[param_ext]$variable:Param
Key
StrToFind : The characters we are looking for
NewStr : The chars to replace with (if any)
variable : The environment variable
param_ext : Any filename Parameter Extension
Param : A command line parameter (e.g. 1)
https://ss64.com/nt/syntax-replace.html
.
--
Best regards,
Jordane
Hi,
If you can store this path in a text file afterwards, I can do that in Python or C if you're interested.
If you can store this path in a text file afterwards, I can do that in Python or C if you're interested.
Hello,
Thank you for the reply.
I have quite limited knowledge of ".Bat", but no idea how to act directly in the ".bat" without having to output the path to an external file?
Thanks anyway for the suggestion.
Thank you for the reply.
I have quite limited knowledge of ".Bat", but no idea how to act directly in the ".bat" without having to output the path to an external file?
Thanks anyway for the suggestion.
Hello,
The Dubcek solution is working perfectly.
Thank you for your help.
Last point: I have a command-line software.
Every time, I need to specify the file path from the root of the disk where it is located (e.g., "C:\Folder 1\Folder 2\Folder 3\File")
If I place this command-line software directly in "Folder 2", is it possible to start it from there?
(e.g., "Folder 2\Folder 2\File")?
Originally it does not work (for your information, I am using it combined with a ".bat".
Thank you
The Dubcek solution is working perfectly.
Thank you for your help.
Last point: I have a command-line software.
Every time, I need to specify the file path from the root of the disk where it is located (e.g., "C:\Folder 1\Folder 2\Folder 3\File")
If I place this command-line software directly in "Folder 2", is it possible to start it from there?
(e.g., "Folder 2\Folder 2\File")?
Originally it does not work (for your information, I am using it combined with a ".bat".
Thank you