Page 1 of 1

[Windows] Editing a string in CMD script?

Posted: January 27th, 2012, 9:43 am
by Largoh
I'm using the following cmd PP script to update my XBMC lib and also pass the downloaded item's name into a php script which does several things such as create an RSS feed, send a notification to XBMC (A pop-up) and a few other bits.
The problem I am having is with items with spaces in their names.

I need to somehow replace the spaces in the %3 veriable passed in the cmd arguments with a '+'.

Here's my script:

Code: Select all

c:\curl.exe http://192.168.0.2:7076/xbmcCmds/xbmcHttp?command=ExecBuiltIn(XBMC.updatelibrary(video))
c:\curl.exe http://localhost:1458/add.php?name=%3
I found the following code on how to replace characters in strings but it didn't seem to work:

Code: Select all

set str=      word       &rem
echo."%str%"
set str=%str: =%
echo."%str%"
What I tried was:

Code: Select all

set newName=%3: =+%
Anyone able to give me a hand here?
Once I get this working properly, I'll move the XBMC update line into the php. I've left it there atm as calling the script sometimes fails due to this issue.

Thanks.