\ vs / vs %

 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi everyone,

I am pretty new to perl so I assume you guys and girls will starting getting
to know me really well.

I have a one line snippet of code that I am trying to run.  The system is
win2k sp3.  I am trying to run the expand command and pass to it some
arguments that contain system variables.

The code: 
#Ok we have renamed the files now we need to run the expand command:
system("expand perfc009.DA_  %windir%\\system32\\perfc009.DAT") && die "no
$!";

and when I run I get it:

C:\Perf>perl -w maintest.pl.txt
Microsoft (R) File Expansion Utility  Version 5.00.2134.1
Copyright (C) Microsoft Corp 1990-1999.  All rights reserved.

Expanding perfc009.da_ to %windir%\system32\perfc009.dat.
Can't open output file: %windir%\system32\perfc009.dat.

no  at maintest.pl.txt line 5.

My first question is; did I do the right thing by putting a \ before the \
in the path?
My second question is whether or not the % sign is messing things up?

Finally I am wondering how best to solve this?  DO you think hard coding the
actual path (instead of using %windir% would help?

Thx again!

Leon

-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0

iQA/AwUBPn9VR0k2S2y0JhBMEQJUewCfRsOIXFTIzWI1Unpo85aw2PWExRgAnRWO
uxuuRslvggSiFyE3bbJYHj7u
=9xua
-----END PGP SIGNATURE-----
INDEPENDENCE COMMUNITY BANK CONFIDENTIALITY NOTICE: This message 
(and any attachment) is confidential and 
intended for the sole use of the individual or entity to which it is addressed. If you are 
not the intended recipient, you must not review, retransmit, convert to hard-copy, 
copy, use or disseminate this email or any of its attachments. If you received this email 
in error, please notify the sender immediately and delete it. This notice is automatically 
appended to all Internet email.


0
lrosenstein
3/24/2003 6:58:16 PM
perl.beginners 29368 articles. 3 followers. Follow

3 Replies
1749 Views

Similar Articles

[PageSpeed] 49

> system("expand perfc009.DA_ %windir%\\system32\\perfc009.DAT")

Try this instead:

system("expand perfc009.DA_ $ENV{'windir'}\\system32\\perfc009.DAT");

Luke
0
Luke
3/24/2003 7:02:08 PM
Try using the %ENV hash.

system("expand perfc009.DA_ $ENV{WINDIR}\\system32\\perfc009.DAT") && die
"no $!";

-----Original Message-----
From: Rosenstein, Leon [mailto:lrosenstein@icbny.com]
Sent: Monday, March 24, 2003 10:58 AM
To: 'beginners@perl.org'
Subject: \ vs / vs % 


 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi everyone,

I am pretty new to perl so I assume you guys and girls will starting getting
to know me really well.

I have a one line snippet of code that I am trying to run.  The system is
win2k sp3.  I am trying to run the expand command and pass to it some
arguments that contain system variables.

The code: 
#Ok we have renamed the files now we need to run the expand command:
system("expand perfc009.DA_  %windir%\\system32\\perfc009.DAT") && die "no
$!";

and when I run I get it:

C:\Perf>perl -w maintest.pl.txt
Microsoft (R) File Expansion Utility  Version 5.00.2134.1
Copyright (C) Microsoft Corp 1990-1999.  All rights reserved.

Expanding perfc009.da_ to %windir%\system32\perfc009.dat.
Can't open output file: %windir%\system32\perfc009.dat.

no  at maintest.pl.txt line 5.

My first question is; did I do the right thing by putting a \ before the \
in the path?
My second question is whether or not the % sign is messing things up?

Finally I am wondering how best to solve this?  DO you think hard coding the
actual path (instead of using %windir% would help?

Thx again!

Leon

-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0

iQA/AwUBPn9VR0k2S2y0JhBMEQJUewCfRsOIXFTIzWI1Unpo85aw2PWExRgAnRWO
uxuuRslvggSiFyE3bbJYHj7u
=9xua
-----END PGP SIGNATURE-----
INDEPENDENCE COMMUNITY BANK CONFIDENTIALITY NOTICE: This message 
(and any attachment) is confidential and 
intended for the sole use of the individual or entity to which it is
addressed. If you are 
not the intended recipient, you must not review, retransmit, convert to
hard-copy, 
copy, use or disseminate this email or any of its attachments. If you
received this email 
in error, please notify the sender immediately and delete it. This notice is
automatically 
appended to all Internet email.



-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
0
tjohnson
3/24/2003 7:16:53 PM
From: "Rosenstein, Leon" <lrosenstein@icbny.com>
> The code: 
> #Ok we have renamed the files now we need to run the expand command:
> system("expand perfc009.DA_  %windir%\\system32\\perfc009.DAT") && die
> "no $!";
> 
> and when I run I get it:
> 
> C:\Perf>perl -w maintest.pl.txt
> Microsoft (R) File Expansion Utility  Version 5.00.2134.1
> Copyright (C) Microsoft Corp 1990-1999.  All rights reserved.
> 
> Expanding perfc009.da_ to %windir%\system32\perfc009.dat.
> Can't open output file: %windir%\system32\perfc009.dat.
> 
> no  at maintest.pl.txt line 5.
> 
> My first question is; did I do the right thing by putting a \ before
> the \ in the path? 

Yes.

> My second question is whether or not the % sign is
> messing things up?

It seems the %variable% was not espanded to the path. What version or 
Perl are you using? (run
	perl -v
to find out).

It's safer to let Perl expand the variable:

	system("expand perfc009.DA_  $ENV{windir}\\system32\\perfc009.DAT")

HTH, Jenda
P.S.: You should use something better than Notepad to edit your 
scripts. And save them with .pl extension, not with .pl.txt.
See eg. http://www.scintilla.org/SciTE.html
===== Jenda@Krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
	-- Terry Pratchett in Sourcery

0
Jenda
3/24/2003 7:19:49 PM
Reply:

Similar Artilces:

VS 2005 vs VS 2008
Hi all ,                  Iam using VS2005 till now and i want to grade up my self with the VS2008 then what are the Added Advantage for me as a DEVELOPER and as a Teamlead as a Project ManagerNothing is impossible as the IMPOSSIBLE word itself says I M Possible...just you have to try..u get all what you desirePradeep BishtBLOG ::--> http://dotnetarmy.blogspot.com/URL ::--> http://www.asp.net   check this URL, http://weblogs.asp.net/cschittko/archive/2007/10/08/visual-studio-2005-or-...

Panel vs PlaceHolder vs UpdatePanel vs ???
I have a need to add controls to a form dynamically.The control type, number, order, properties, etc. will not be known until run time so no controls can be predefined. In general, a source defines which controls must be added to a form, a user will make some entries/selections and submit.On postback, the user's submission will be processed and some controls' property values, perhaps even the controls themselves, will change with the updated results displayed to the user. There are numerous ways to handle dynamic controls.I've considered Panels, Pl...

Confused between XMLDocument vs XPathDocument vs XMLTextReader vs SAX vs DOM
Hello, I am confused between XMLDocument vs XPathDocument vs XMLTextReader vs SAX vs DOM when to use which? I have to parse an xml document in VS 2005 using C#. Can someone answer this...just want to know the if I can use SAX in .NET or use the regular lib's...

VS 2005 Vs VS 2008 #2
Hi, Can anyone let me know the updates in VS 2008 over VS 2005.    Hi, for example: http://weblogs.asp.net/cschittko/archive/2007/10/08/visual-studio-2005-or-2008-what-s-more-risk.aspxThanks,Teemu KeiskiFinland, EU...

GridView vs DataList vs Repeater vs Formview vs DetailsView
In development there is always a question which control to choose. I think many developers including myself are not clear on which control should be should for which purposes. Can you pls explain what are the pros and cons of these controls and also why some say that Gridview is a heavy control and repeater is a light control what does that mean. what makes a control heavy and what makes a control light......does it really matter in professional applications  which control you use? kindly throw some light. thanks. Still kind of new myself, but this is what my book says:Control - Cap...

mySql vs msSql vs msSql2005Express vs MsAccess
Can Someone tell me what is the pros & cons of the above database? Is there any good links for the above topic? Thank you.chankl78 MySQL free open source RDBMS(relational database management systems) with limited features pros free con limited features. Microsoft SQL Server one of the big three RDBMS Express is just an edition, while SQL Server is now number one in relational calculus that part is not included in Express because it is totally free. http://www.microsoft.com/sql/prodinfo/features/compare-features.mspx Express pros free con without data automation and relational...

VS.NET 2005 vs VS.NET 2003
I have used VS.NET 2003 extensively and exploited all features like drag and drop functions for creating components, drag and drop data access components...For example VS.NET 2003 allows creating sqldataadapter for table mapping , stored proc parameters mappings etc..We can drag pretty much any object on component designer....Not it seems like all that gone...VS.NET 2005, there is no way we can drag the typed dataset, sqldata adapter, sqlcommand on forms designer . There is no concept of component. There is no component designer any more....Biggest flaw i found is sqldatasource and...

VWD VS VS?
I have VWD Express and I have Visual Studio Standard on my learning/development machine. Is there any reason to use VS over VWD. I think VS may have some deployment features that VWD Express does not, but I could always switch over to VS if I needed. I've used both on the same projects and that hasn't caused me any problems so far. Pros and cons? Thanks. James http://blogs.msdn.com/mikhailarkhipov/archive/2006/06/26/647516.aspx BTW, typica VS license is per user, not per machine, you may be able to use VS on more than one machine - check the EULA.Thanks-----------------------------------...

//p vs ($??{ }) vs ...
Let me see if I can translate for you. I hate impasses, especially on stuff I'm using :-) I believe Ilya wants to make a //p option that will postpone regexp interpolation on all variables used in the regexp until match time: $foo = "then"; $re = qr/$foo/p; $foo = "now"; "how now" =~ /$re/ && print "This should match"; With RC1 (which doesn't have //p), you have to write that as: $re = /(??{ $foo})/; Sarathy seems to be a little confused about the interaction between //p and (?{ ... }) blocks. My und...

the Bat! vs. Pegasus vs. Eudora vs. others
Hello, all... the time has finally come for me to roll out a new email client on my company's network. yes, happy days are here... and i've finally convinced the powers that be to allow me to prohibit the use of Outlook and Outlook Express for POP and SMTP at the company where i work. So... i will be in the market for a new email client and i wanted to just toss a few points that i'm thinking about into the newsgroups (follow-ups set to grc.security only) since i know that many of you have already taken these steps in the right direction. The following are condition...

IBS vs. DNN vs. RP vs. PSK
What are the main differences between the IBuySpy, DotNetNuke, Rainbow Portal, and Portal Starter Kit tools? I'm just starting to look at them and don't really want to dig down into each individual one to find its pros/cons. Can someone point me to an existing assessment? I know that DNN is based on IBS (I think Rainbow is, too), but I don't know what was added/changed. Nor do I know how these differ from the starter kit that was released by Microsoft. If anyone can help me out, here, I'd really appreciate it. Thanks.Michael Flanakin | Microsoft Consulting Serviceswww.michaelflanakin.com...

VS 6.0 VS 2003 and VS 2008
I have 3 visual studios running. and I have 3 .Net runtimes on my computer. After installing 2008 express with 2.0 and 3.5. I have lost ability to run my debugger using visual studio 2003 pro.  I am using IIS 5.1 and window xp pro. Visual studio 2003 is working fine but when I want to run it in debug mode the debuger doesn't stop at break points. I am also unable to attach the aspnet_wp.exe process manually. It shows up and but it is grayed out.  See the screen below. I have tried reregistering aspnet_iisreg.exe for each run time. I have also repaired the vs 2003 using...

IBS vs. DNN vs. RP vs. PSK
What are the main differences between the IBuySpy, DotNetNuke, Rainbow Portal, and Portal Starter Kit tools? I'm just starting to look at them and don't really want to dig down into each individual one to find its pros/cons. Can someone point me to an existing assessment? I know that DNN is based on IBS (I think Rainbow is, too), but I don't know what was added/changed. Nor do I know how these differ from the starter kit that was released by Microsoft. If anyone can help me out, here, I'd really appreciate it. Thanks.Michael Flanakin | Microsoft Consulting Serviceswww.michaelflanakin.com ...

New features in VS 2008 vs VS 2005
Hello friends !! I'm completly new in Visual Studio 2008, Let me know  what are the advantages to use VS 2008 compare with VS 2005. Plz provides some practical apprachs. Thanks @@ Happy Coding..HI@@ That's always a difficult question, as it's mixed between what Visual Studio offers and what .NET 3.x frameworks offer. You don't HAVE to have VS2008 to use the new framework, but it has been designed to make it all easier. Are you interested in the actual Visual Studio differences or the framework differences?     http://blogs.msdn.com/...

Web resources about - \ vs / vs % - perl.beginners

Look, It’s A New Star Wars Trailer!
In case you can’t get enough Star Wars Episode VII trailers, Disney is here for you. The company aired a brand new teaser last night during the ...

My Morning Advice: Don't Talk About Taking Down Donald Trump. Just Take Him Down.
Here's the latest on GOP panic over the possibility that Donald Trump might actually win the Republican nomination: A well-connected GOP operative ...

Deputies: 1 Dead, 1 Wounded in Tampa Hospital Shooting
Deputies: 1 dead, 1 wounded in shooting at Florida Hospital in Tampa

Mali TV airs images of man, woman suspected in hotel attack
Reuters Mali TV airs images of man, woman suspected in hotel attack Reuters BAMAKO Authorities in Mali published photographs on Monday of ...

Pfizer To Buy Allergan For $160B, Create World’s Largest Drug Company
If the giant pharmaceutical companies of the world seem quite big enough to you already, well, that just means you probably aren’t a major investor ...

‘The Walking Dead’ episode 7: A heart-pounding answer to ‘the Glenn question’
The seventh episode of The Walking Dead season 6 aired last night, and it had an interesting overall theme: people need saving. Unexpectedly, ...

Windows at 30: Microsoft’s biggest blunders
Windows at 30: Microsoft’s biggest OS goofs Image by Johnathan Nightingale via Flickr In the high-stakes, high-paced world of tech, surviving ...

Rory Mcilroy wins to wrap up Race to Dubai
WCYB Rory Mcilroy wins to wrap up Race to Dubai WCYB McIlroy trailed rising young star Sullivan around the turn, but a run of four birdies ...

Mockingjay Part 2 ruled the box office, did poorly for the series: did you see it?
Mockingjay Part 2 , the final entry in the Hunger Games series, dominated the box office its opening weekend with an expected $101 million take. ...

Washington Post Tehran Bureau Chief Jason Rezaian Reportedly Sentenced To Prison On Espionage Charges ...
Washington Post Tehran Bureau Chief Jason Rezaian has been convicted by an Iranian court to an unspecified amount of prison time, in the latest ...

Resources last updated: 11/23/2015 3:36:52 PM