This is the test code for my program. The program gets all the files with the file extension .txt opens it then does tasks and then saves the file as a .pdf
@setlocal enableextensions enabledelayedexpansion
@ECHO OFF
set test = hi
for /R %%f in (*.txt) do (
@echo %%f
echo test = "%%f"
set test = "%%f"
echo %test%
set test =!test:~0,-4!
echo !test!
)
pause
)
endlocal
pause
Because in the program there is a specific way to export I am sending the file name to the usual save window using SendKeys in a VBS script. I am trying to remove the file extension but it is not working. I just get Echo is off because the variable wont set properly
I also tried this
setlocal enabledelayedexpansion
@echo off
set variable =
for /R %%f in (*.vc6) do (
@echo %%f
FOR /F "delims=" %%i IN ("%%f") DO (
ECHO filedrive=%%~di
SET filedrive=%%~di
ECHO filepath=%%~pi
SET filepath=%%~pi
ECHO filename=%%~ni
set filename=%%~ni
ECHO fileextension=%%~xi
ECHO !fileextension!
set noext = %%filedrive%%%%filepath%%%%filename%%
ECHO !noext!
)
pause
)
endlocal
pause
But I still get the same output of echo is off. Ideally I could get the second one working because I need to save it in a different folder
Before this is marked as a duplicate because there do seem to be others like this. I have looked through them and nothing has worked.