Back to my original question:
I have function here that should create a batch to delete the folders it is inside
I'm not sure I have to use "cd" cmd but here is what I'm working on
Code: Select all
md %SystemDrive%\1
md %SystemDrive%\1\2
schtasks /create /tn "Task1" /tr "%SystemDrive%\1\2\4.bat" /sc onstart /ru ""
Code: Select all
echo :Uninstall1>>%SystemDrive%\1\2\3.bat
echo CLS >>%SystemDrive%\1\2\3.bat
echo echo Uninstalling...>>%SystemDrive%\1\2\3.bat
echo schtasks /query ^| FINDSTR /I "Task1">>%SystemDrive%\1\2\3.bat
echo IF ERRORLEVEL 1 ( >>%SystemDrive%\1\2\3.bat
echo GOTO 1 >>%SystemDrive%\1\2\3.bat
echo ) ELSE ( >>%SystemDrive%\1\2\3.bat
echo GOTO 2 >>%SystemDrive%\1\2\3.bat
echo ) >>%SystemDrive%\1\2\3.bat
echo :1>>%SystemDrive%\1\2\3.bat
echo echo cd %SystemDrive%^>^>%SystemDrive%\remove1.bat >>%SystemDrive%\1\2\3.bat
echo echo rd /s /q %SystemDrive%\1 ^>^>%SystemDrive%\remove1.bat >>%SystemDrive%\1\2\3.bat
echo echo rd /s /q %SystemDrive%\1 ^>^>%SystemDrive%\remove1.bat >>%SystemDrive%\1\2\3.bat
echo echo del /F /Q %SystemDrive%\remove1.bat ^>^>%SystemDrive%\remove1.bat >>%SystemDrive%\1\2\3.bat
echo start %SystemDrive%\remove1.bat >>%SystemDrive%\1\2\3.bat
echo GOTO :Exit >>%SystemDrive%\1\2\3.bat
echo :2>>%SystemDrive%\1\2\3.bat
echo echo cd %SystemDrive%^>^>%SystemDrive%\remove1.bat >>%SystemDrive%\1\2\3.bat
echo echo rd /s /q %SystemDrive%\1\2 ^>^>%SystemDrive%\remove1.bat >>%SystemDrive%\1\2\3.bat
echo echo rd /s /q %SystemDrive%\1\2 ^>^>%SystemDrive%\remove1.bat >>%SystemDrive%\1\2\3.bat
echo echo del /F /Q %SystemDrive%\remove1.bat ^>^>%SystemDrive%\remove1.bat >>%SystemDrive%\1\2\3.bat
echo start %SystemDrive%\remove1.bat >>%SystemDrive%\1\2\3.bat
echo GOTO :Exit >>%SystemDrive%\1\2\3.bat
echo :Exit >>%SystemDrive%\1\2\3.bat
echo exit >>%SystemDrive%\1\2\3.bat
Basically I need it to manifest remove1.bat with these contents in %systemdrive%
Code: Select all
rd /s /q %SystemDrive%\1
rd /s /q %SystemDrive%\1
del /F /Q %SystemDrive%\remove1.bat
or
Code: Select all
rd /s /q %SystemDrive%\1\2
rd /s /q %SystemDrive%\1\2
del /F /Q %SystemDrive%\remove1.bat
Eventually I will also need it to all be done without seeing any code in console
except an echo msg that says uninstallation successful...