StrokesPlus.net
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
ETime  
#1 Posted : Sunday, January 17, 2021 8:54:24 AM(UTC)
ETime

Rank: Newbie

Reputation:

Groups: Approved
Joined: 4/16/2020(UTC)
Posts: 7

1. How to set the working directory? (I can find it in sp, but not in sp.net)
2. How to elevated a program?
Rob  
#2 Posted : Sunday, January 17, 2021 3:07:55 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,349
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 416 time(s) in 354 post(s)
1.
Code:
//Show current working directory
let currDir = clr.System.IO.Directory.GetCurrentDirectory();
sp.MessageBox(currDir, "Current Directory");

//Set new working directory
clr.System.IO.Directory.SetCurrentDirectory("C:\\Temp");

//Show new working directory
currDir = clr.System.IO.Directory.GetCurrentDirectory();
sp.MessageBox(currDir, "Current Directory");

2.
Code:
// runas is the important part here, that verb triggers the elevation (UAC prompt)
sp.RunProgram("notepad.exe", "", "runas", "normal", true, false, false);
ETime  
#3 Posted : Tuesday, January 19, 2021 10:24:50 AM(UTC)
ETime

Rank: Newbie

Reputation:

Groups: Approved
Joined: 4/16/2020(UTC)
Posts: 7

It works, thanks.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.