Click here to Skip to main content
15,911,141 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have powershell script in my d drive and i need to execute it from c# windows programe .I tried below but not .success

What I have tried:

tring filepath = "D:\\JournalImport";
                String cmd = "-Command ";
                System.Diagnostics.Process process = new System.Diagnostics.Process();
              
                process.StartInfo.FileName = "D:\\JournalImport\\JrnlImport.ps1";
                
                process.StartInfo.WorkingDirectory = filepath;
                process.StartInfo.Arguments = cmd;
                process.Start();
                process.WaitForExit(15000000);
                process.Close();
Posted
Updated 15-Apr-18 22:10pm
Comments
Richard MacCutchan 16-Apr-18 4:11am    
"but not success"
Please edit your question and explain what that is supposed to mean.

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900