- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Having to initialize setvars.bat is really tedious and troublesome.
It hinders usability of any oneAPI programs, either,
- Open cmd, enter "%ONEAPI_ROOT%setvars.bat", then enter ".exe".
- Write another program, which runs the setvars.bat then run the actual application.
Are there any alternatives, like an callable API to set them from inside the program instead?
For Visual Studio development, there's Automate the setvars.bat Script with Microsoft Visual Studio* which is really handy.
However, from end user perspective, (whether a program consuming a .dll written using oneAPI or a person using an .exe that uses oneAPI) I wish to just call the .dll functions / double click the .exe without having to run setvars.bat.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Choon,
In windows, if you use Visual Studio there is no need to run setvars.bat every time. If you want to use the command prompt and doesn't want to run setvars.sh use "Intel OneAPI Command Prompt" which runs the script on initialization.
Regards
Prasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes,
However, I want to run a program .exe by double-clicking it.
Not through a command prompt, nor a special command prompt, nor Visual Studio.
Is there any way around this setvars.bat.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Sorry for the delay in response.
Currently, it is not possible to use Intel Compilers without loading them.
So, running setvars.bat is mandatory as of now.
If you need to run the executables without running setvars.bat everytime. Now while this is not the recommended way but you can try make it run while loading windows as a startup script.
For making the script run by default during startup follow the steps below:
- Create a shortcut to the batch file.
- Once the shortcut is created, right-click the shortcut file and select Cut.
- Press Start, type Run, and press Enter.
- In the Run window, type shell:startup to open the Startup folder.
- Once the Startup folder is opened, click the Home tab at the top of the folder. Then, select Paste to paste the shortcut file into the Startup folder.
There might be many other ways if you search online.
Let us know if this helps.
Regards
Prasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried the startup script before, also did it again just to verify.
It doesn't work as the modifications only applies to the console running the script on startup and closes after it finishes.
Thanks for the confirmation though, I still hope to see a workaround, like via an API call.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Create a batch file that runs the setvars.bat and/or any other environment variable setups. Then follow this with the command: start YourProGram arg arg arg
and then end with the command: exit
Dummy test example:
foo.bat containing:
date /t>foo.txt
start notepad foo.txt
exit
If you double click on foo.bat from the File Explorer, the foo.bat file runs, creates foo.txt, then uses notepad to open the file, then exits the cmd window executing foo.bat.
YourLauncher.bat
setvars.bat
start YourProgram arg arg arg
exit
Then Create a shortcut to YourLauncher.bat and set the properties to Run Minimized.
This will provide you to name the shortcut to whatever you want and to hide the short duration blip of the cmd window setting the environment and launching your app.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I believe this would work, for an executable.
However, for a library (dll), it is weird to impose such a requirement on the executable (or other libraries) consuming the library.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Choon,
We are forwarding this thread to the internal team who can comment better regarding if a workaround is possible or not.
Regards
Prasanth
![](/skins/images/B7BA37F9CE4B52FF7CAE1FB0388839C8/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page