2014-09-10 40 views
0

我一直在试图修改使用Cygwin因为大多数驱动器上的页面文件大小或我们的服务器只能访问Cygwin和不直CMD。Cygwin的+ WMIC页面文件设置

这里是我的试验的概述,请注意,最后一个命令是成功的,但我不能运行它,因为它需要首先输入'cmd'然后命令交互式,无法通过脚本完成(尽可能我可以得到) :

[email protected] ~ 
$ wmic pagefileset where name='d:\\pagefile.sys' set InitialSize=10000,MaximumSize=20000 
ERROR: 
Description = Invalid query 

[email protected] ~ 
$ cmd /c "wmic pagefileset where name='d:\\pagefile.sys' set InitialSize=10000,MaximumSize=20000" 
ERROR: 
Description = Invalid query 

[email protected] ~ 
$ powershell -c "wmic pagefileset where name='d:\\pagefile.sys' set InitialSize=10000,MaximumSize=20000" 
Invalid format. 
Hint: <assignlist> = <propertyname>=<propertyvalue> [, <assignlist>]. 

[email protected] ~ 
$ cmd 
Microsoft Windows [Version 6.3.9600] 
(c) 2013 Microsoft Corporation. All rights reserved. 

C:\cygwin\home\Administrator>wmic pagefileset where name='d:\\pagefile.sys' set            InitialSize=10000,MaximumSize=20000 
wmic pagefileset where name='d:\\pagefile.sys' set InitialSize=10000,MaximumSize             =20000 

Updating property(s) of '\\DOCK\ROOT\CIMV2:Win32_PageFileSetting.Name="D:\\pagef            ile.sys"' 
Property(s) update successful. 

有关如何通过CYGWIN运行此命令并且不会收到“无效查询”的任何建议?

回答

0

这是通过创建一个.bat文件并从允许页面文件更新的.sh文件调用它解决的。

0
[email protected] ~ 
$ wmic pagefileset where 'name="C:\\pagefile.sys"' delete 

Deleting instance \\DARWIN-TEST7-WI\ROOT\CIMV2:Win32_PageFileSetting.Name="C:\\pagefile.sys" 
Instance deletion successful. 

[email protected] ~ 
$ wmic pagefileset create name="C:\\pagefile.sys" 

Instance creation successful. 

[email protected] ~ 
$ wmic pagefileset where 'name="C:\\pagefile.sys"' set InitialSize=512,MaximumSize=512 

Updating property(s) of '\\DARWIN-TEST7-WI\ROOT\CIMV2:Win32_PageFileSetting.Name="C:\\pagefile.sys"' 

Property(s) update successful. 
+0

如果你可以添加一些解释,如果你做了什么(如果有的话),你做了不同的工作。 – 2014-11-21 18:09:29

+0

嗨,安德鲁,我通过使用cygwin脚本(bash)以及(批处理)文件解决了这个问题。我最后使用了Bash文件来调用.bat文件。 – Skowt 2014-11-22 17:57:29

+0

区别在于:'name =“C:\\ pagefile.sys”'(两个单引号) – RBuser2769569 2014-12-09 14:25:22