-
Notifications
You must be signed in to change notification settings - Fork 0
/
new_sample.bat
40 lines (28 loc) · 1.04 KB
/
new_sample.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
@echo off
setlocal enableextensions enabledelayedexpansion
REM Prompt the user to input the new file name
set /p new_project_name=Enter new Project:
REM Set source and destination folder paths
set source_folder=template
set destination_folder=samples/%new_project_name%
REM Copy folder and all its contents
xcopy "%source_folder%" "%destination_folder%" /E /I
REM Prompt the user to input the new file name
rem set /p new_file_name=Enter new file name (without extension):
REM Rename specific files
set "inputFile=%destination_folder%\template.sln"
set "outputFile=%destination_folder%\%new_project_name%.sln"
for /f "delims=" %%a in ('type "%inputFile%"') do (
set "line=%%a"
set "line=!line:template=%new_project_name%!"
echo !line!>>"%outputFile%"
)
del "%inputFile%"
set "inputFile=%destination_folder%\template.vcxproj"
set "outputFile=%destination_folder%\%new_project_name%.vcxproj"
for /f "delims=" %%a in ('type "%inputFile%"') do (
set "line=%%a"
echo !line!>>"%outputFile%"
)
del "%inputFile%"
echo New project generated successfully.