简体   繁体   English

从终端以信息亭模式打开Goog​​le Chrome(所有用户安装)

[英]Open google chrome (all users installation) in kiosk mode from terminal

I execute this in order to open Google chrome in kiosk mode: 我执行此命令以在信息亭模式下打开Goog​​le chrome:

"C:\\Users\\Javier\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe" --user-data-dir=$(mktemp -d) --kiosk "url" “ C:\\ Users \\ Javier \\ AppData \\ Local \\ Google \\ Chrome \\ Application \\ chrome.exe” --user-data-dir = $(mktemp -d)--kiosk“ url”

but, what I need to modify if google chrome is installed in Program Files(x86)? 但是,如果在Program Files(x86)中安装了谷歌浏览器,我需要修改什么? If I execute: 如果我执行:

"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe --user-data-dir=$(mktemp -d) --kiosk "url" “ C:\\ Program Files(x86)\\ Google \\ Chrome \\ Application \\ chrome.exe --user-data-dir = $(mktemp -d)--kiosk“ url”

I get an error in --user-data-dir=$(mktemp -d) sentence. 我在--user-data-dir = $(mktemp -d)语句中收到错误。

Thanks in advance. 提前致谢。 Javier 哈维尔

I think there may be no elegant solution at this point. 我认为目前可能没有优雅的解决方案。 " mktemp -d " is a linux/unix command and I can't find it, or an equivalent, on windows. mktemp -d ”是linux / unix命令,我在Windows上找不到它或等效命令。 It may have worked at one time ( I stumbled on mktemp on a microsoft development page ), but on 8.1 it didn't. 它可能曾经起作用过( 我在Microsoft开发页面上偶然发现了mktemp ),但是在8.1上却没有。 The error I was getting said it had to do with permissions, but that wasn't the case. 我说的错误与权限有关,但事实并非如此。

If someone could get commands in Cygwin working at the windows command prompt then maybe the above would work. 如果有人可以在Windows命令提示符下的Cygwin中获取命令,则上述方法可能会起作用。 Another option may be to create something for PowerShell that does the same and plug that in there. 另一个选择可能是为PowerShell创建可以执行相同操作的东西,然后将其插入其中。

"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" --user-data-dir=c:\\somedir --kiosk "some.url.here" does work though. 不过,“ C:\\ Program Files(x86)\\ Google \\ Chrome \\ Application \\ chrome.exe” --user-data-dir = c:\\ somedir --kiosk“ some.url.here” 确实可以工作。 It works from a shortcut, so it should also work from the command line, but you do lose the random temp directory. 它可以通过快捷方式运行,因此也可以从命令行运行,但是您会丢失随机的temp目录。

For my case, I just wanted some websites/web-apps to default full screen (F11) from a shortcut and I'd just Alt-F4 to close, and Alt-Tab between them and the desktop. 就我而言,我只是希望某些网站/网络应用通过快捷方式默认为全屏(F11),而我只是要关闭Alt-F4,并在它们和桌面之间关闭Alt-Tab。 As it is, I'm thinking I'll have to make a separate data-dir for each one I want to do. 就这样,我想我必须为每个我想做的数据创建一个单独的数据目录。

I was using the command chrome.exe --user-data-dir=$(mktemp -d) --kiosk http://someUrl/ and it was working well for over a week until I started testing my program with a limited privilege user today. 我使用的命令是chrome.exe --user-data-dir = $(mktemp -d)--kiosk http:// someUrl /,并且运行了一个多星期,直到我开始以有限的权限测试程序今天的用户。 I noticed that chrome process itself did not start after calling process.start() method. 我注意到,在调用process.start()方法后,chrome进程本身并未启动。 There were no entries in event logs to see what went wrong. 事件日志中没有条目可以查看出了什么问题。 After looking at your solution, I changed my program to generate a temp folder using C# command pass it as an argument and it started working. 在查看了您的解决方案之后,我将程序更改为使用C#命令生成一个临时文件夹,并将其作为参数传递并开始工作。 Thanks for the help. 谢谢您的帮助。 This is the simplified version of the code I use. 这是我使用的代码的简化版本。

DirectoryInfo tempDirectory = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), "Chrome" + DateTime.Now.ToString("ddMMHHmmss")));

Process process = new Process();
process.StartInfo.FileName = GetBrowserPathFromRegistry();
process.StartInfo.Arguments = String.Format("--user-data-dir={0} --kiosk {1}", tempDirectory.FullName, this.uri);
process.Start();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM