I want to register the name of the computer where my script is running. Is it possible to get this info?

 採用された回答

Ameer Hamza
Ameer Hamza 2018 年 4 月 29 日

3 投票

Check this FEX submission. Or you can simply try following commands
[ret, name] = system('hostname')
name = getenv('COMPUTERNAME'); % for windows
name = getenv('HOSTNAME')

1 件のコメント

nan
nan 2020 年 8 月 18 日
This does not work when running a VPN on a Mac (running Catalina); the hostname is replaced by an IP address.

サインインしてコメントする。

その他の回答 (1 件)

scivision
scivision 2024 年 9 月 18 日

0 投票

Get the hostname of the local machine with built-in Java
name = string(java.net.InetAddress.getLocalHost().getHostName());

カテゴリ

ヘルプ センター および File ExchangeStartup and Shutdown についてさらに検索

タグ

質問済み:

2018 年 4 月 29 日

回答済み:

2024 年 9 月 18 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by