Wie kann ich meine exe ausführen Via Powershell?
Hallo, ich habe ein Programm geschrieben, was Dateien in andere Formate formatieren kann. Jetzt würde ich es gerne mit Powershell starten, aber es passiert einfach nichts. wenn ich aber die Exe ausführe funktioniert alles.
Diesen Pfad benutze ich:
$executablePath = ‘D:\test6\ConvertMenu.exe’
# Starte das C#-Projekt
Start-Process -FilePath $executablePath -Wait
Since Powershell does not generate an error message in your case, your program seems to be started at least successfully (to stop yourself without any message)
If you run your program via “Start-Process”, this happens in another window. If the program does not itself have mechanisms to keep the relevant window open, it may snap so quickly that you do not get any (error) messages to face!
Start process is used only if the result of the program execution should not have any influence on the calling script. (apart from -Wait)
Should the called program operate its issues within the console of the running script, use the & call operator or .-dotsourcing .
Demo.ps1
…who needs VisualStudio to compile C#? 😅
As much as I know, the Powershell does not execute .EXE files. The Powershell is not meant for that. .EXE files are running only and do not require any surface from which they must be started.
On the other hand, .BAT files can be executed in a powershell, e.g. the autoexec.asked
Your xyz.exe file should therefore be a xyz.bat file. It is not enough to simply rename a file to xyz.bat.
Where did you get that bullshit?
With Powershell you can start/execute pretty much everything:
From Windows 11 22H2 the fileassociation was removed to .bat. Windows batch files have (for 30 years) the ending .cmd
..and autoexec.bat died no later than Windows98
Windows batch files have (for 30 years) the ending.cmd
Unauthorised
cmd is only the call of the command line
Is called via Windowskey+R.
If you have no idea, you should leave it to write Unfug.
There’s someone hanging out of the window.
Look at my “playground”:
In Batch and Powershell, you should certainly not try to measure with me!
is usually sufficient. If your program does not start over it, check the event display, which is logged there.
There’s nothing happening.
If Powershell does not provide an error message when calling via &-Calloperator /.-dotSourcing, it must be obvious.
Perhaps your program will only end without any message from itself.