Perforce Public Knowledge Base - Using Special Characters
Reset Search



Using Special Characters

« Go Back



How do I work around special characters on the p4 command line?


Perforce uses the characters * and # in file specifications. These characters also have special meaning in many command shells, which might require you to use quotes in your p4 commands. (On Unix, use single quotes; in the Windows MS-DOS shell, use double quotes.)

Example using # symbol

p4 sync #none

should remove all depot files from your workspace. If you find that what happens instead is that it syncs your entire workspace to head revisions, it is because your command shell interprets # as a comment character. If this misinterpretation happens, try:

p4 sync '#none'

Example using asterisk

Or, for instance, if a command like

p4 files stuff/*

complains "no files found," it might be because your command shell is trying to expand the * wildcard before Perforce even sees it. There are a number of ways you can use quotes. For example:

MS-DOSp4 files "stuff/*"
p4 files stuff/"*"

Unixp4 files 'stuff/*'
p4 files stuff/'*'
p4 files stuff/*

(Note that this would not work in MS-DOS batch scripts, where %1 is special.)

Notes about the double forward slash

Perforce also makes frequent use of the double forward slash character combination "//" when referencing file paths. The // character combination might be interpreted by your shell as referencing a Universal Name Convention (UNC) path instead of a Perforce depot or client workspace path. If you experience abnormally long delays in getting results from Perforce commands using the //depot or //clientname syntax, try quoting the entire path string. In general, only Unix shells on Windows are susceptible to this particular problem. For delays related to other network issues, see Isolating Network Problems
Related Links



Was this article helpful?



Please tell us how we can make this article more useful.

Characters Remaining: 255