-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update and rename Program.cs to spA.cs
changed the filename changed the classname added the creation of appdata spar folder if not found
- Loading branch information
Showing
2 changed files
with
38 additions
and
23 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using System.IO; | ||
|
||
public class spA | ||
{ | ||
public static void Main() | ||
{ | ||
// Get the current directory | ||
string currentDirectory = Environment.CurrentDirectory; | ||
|
||
// Prepare the command to set the path | ||
string command = $"@cd /d {currentDirectory}"; | ||
|
||
// Get the path to the AppData folder | ||
string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); | ||
|
||
// Specify the new folder in AppData | ||
string folderName = "SavePathAndReturn"; | ||
string tempPath = Path.Combine(appDataPath, folderName); | ||
|
||
// Check if the folder exists and create it if it doesn't | ||
CreateFolderIfNotExists(tempPath); | ||
|
||
// Create the full path to the .cmd file in the new folder | ||
string cmdFilePath = Path.Combine(tempPath, "SetPath.cmd"); | ||
|
||
// Write the command to a .cmd file in the new folder | ||
File.WriteAllText(cmdFilePath, command); | ||
} | ||
|
||
private static void CreateFolderIfNotExists(string folderPath) | ||
{ | ||
if (!Directory.Exists(folderPath)) | ||
{ | ||
Directory.CreateDirectory(folderPath); | ||
} | ||
} | ||
} |