문제

I try to launch a self written autoit application called "KeyShortcuts.exe" using a batch called "launchMacros.bat". This applications provides keyboard shortcuts for various things and includes a GUI which shows me the available shortcuts.

launchMacros.bat:

start "MyMacros" "M:\applications\AutoIt\KeyShortcuts.exe"

The application does start and I'm able to use every shortcut but I'm not able to see the GUI.

If I start the application direct (double click on KeyShortcuts.exe) everythings works fine.

I also tryed starting the application using runas:

runas /user:REQUIREDUSERNAME /savecred "M:\applications\AutoIt\KeyShortcuts.exe"

Same problem here. Even right click -> "Run as administrator" doesnt worked.

Any suggestions?

도움이 되었습니까?

해결책

If your batch file is in a different directory than KeyShortcuts.exe, you may need to specify the starting directory using the /D parameter for START.

Like this:

START "MyMacros" /D "M:\applications\AutoIt" "M:\applications\AutoIt\KeyShortcuts.exe"

다른 팁

Every batch file launched from Windows GUI create a new console window, run the batch file, then close. If you need this to be different, there's several ways:

  1. Create a shortcut to CMD /K YOURBATCHFILE.BAT
  2. Add a pause to your BAT file

Here's a demonstration of method 1:

  1. New > Shortcut
  2. Type the location of the item: C:\Windows\System32\CMD.EXE
  3. Type the name for this shortcut: InsertYourNameHere
  4. Click Finish
  5. Right click on your Shortcut and go properties
  6. Change Target to: C:\Windows\System32\CMD.EXE /K "InsertYourBatchFileName.BAT"
  7. Click OK

Done, now you have a shortcut that opens a new console window and leaves it open whilst ir runs your batch file.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top