Okay I have this script which uses a for loop to search through all batch files on the computer, I want to disable them by turning them Into a text file. However I need to modify a variable but it will not set.
Here is the script
for %%A in ("%CD%") do set topfolder=%%~DA\
setlocal enabledelayedexpansion
for /l %%x in (1,0,2) do (
for %%A in (*.bat) do echo "%%~DPNXA"
for /r %%X in (*.bat) do echo "%%X"
CD..
if "!CD!"=="%TOPFOLDER%" call :end )
:end
What I'm trying to do is set this variable
for %%A in ("%CD%") do set topfolder=%%~DA\
setlocal enabledelayedexpansion
for /l %%x in (1,0,2) do (
for %%A in (*.bat) do set "file1=%%~DPNXA"
for /r %%X in (*.bat) do set "file2=%%X"
Echo !file1!
Echo !file2!
Pause
CD..
if "!CD!"=="%TOPFOLDER%" call :end )
:end
For some reason I just can't get the value "℅℅~DPNXA" To equal "!file1!" And I can't get "%%X" to equal to "!file2!", I want to do this so a can change them to something like this
"!file1:~0,-4!.txt".